Reduce rightward drift
This commit is contained in:
parent
eeb2a6203b
commit
bbc58e8ccc
2 changed files with 85 additions and 88 deletions
|
@ -1215,24 +1215,23 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
|
|||
}
|
||||
|
||||
fn maybe_expand_private_type_alias(cx: &mut DocContext<'_>, path: &hir::Path<'_>) -> Option<Type> {
|
||||
let mut alias = None;
|
||||
if let Res::Def(DefKind::TyAlias, def_id) = path.res {
|
||||
let Res::Def(DefKind::TyAlias, def_id) = path.res else { return None };
|
||||
// Substitute private type aliases
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let Some(def_id) = def_id.as_local() else { return None };
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
if !cx.cache.access_levels.is_exported(def_id.to_def_id()) {
|
||||
alias = Some(&cx.tcx.hir().expect_item(hir_id).kind);
|
||||
}
|
||||
}
|
||||
let alias = if !cx.cache.access_levels.is_exported(def_id.to_def_id()) {
|
||||
&cx.tcx.hir().expect_item(hir_id).kind
|
||||
} else {
|
||||
return None;
|
||||
};
|
||||
let hir::ItemKind::TyAlias(ty, generics) = alias else { return None };
|
||||
|
||||
if let Some(&hir::ItemKind::TyAlias(ref ty, ref generics)) = alias {
|
||||
let provided_params = &path.segments.last().expect("segments were empty");
|
||||
let mut ty_substs = FxHashMap::default();
|
||||
let mut lt_substs = FxHashMap::default();
|
||||
let mut ct_substs = FxHashMap::default();
|
||||
let generic_args = provided_params.args();
|
||||
{
|
||||
|
||||
let mut indices: hir::GenericParamCount = Default::default();
|
||||
for param in generics.params.iter() {
|
||||
match param.kind {
|
||||
|
@ -1300,11 +1299,8 @@ fn maybe_expand_private_type_alias(cx: &mut DocContext<'_>, path: &hir::Path<'_>
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some(cx.enter_alias(ty_substs, lt_substs, ct_substs, |cx| ty.clean(cx)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl Clean<Type> for hir::Ty<'_> {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#![feature(control_flow_enum)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![feature(let_else)]
|
||||
#![feature(nll)]
|
||||
#![feature(test)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue