diff options
Diffstat (limited to 'src/librustdoc/clean/mod.rs')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 5a1b4d2f8ce..f2bf7ead561 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -71,56 +71,56 @@ thread_local!(pub static MAX_DEF_ID: RefCell<FxHashMap<CrateNum, DefId>> = Defau const FN_OUTPUT_NAME: &'static str = "Output"; // extract the stability index for a node from tcx, if possible -fn get_stability(cx: &DocContext<'_, '_, '_>, def_id: DefId) -> Option<Stability> { +fn get_stability(cx: &DocContext<'_>, def_id: DefId) -> Option<Stability> { cx.tcx.lookup_stability(def_id).clean(cx) } -fn get_deprecation(cx: &DocContext<'_, '_, '_>, def_id: DefId) -> Option<Deprecation> { +fn get_deprecation(cx: &DocContext<'_>, def_id: DefId) -> Option<Deprecation> { cx.tcx.lookup_deprecation(def_id).clean(cx) } pub trait Clean<T> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> T; + fn clean(&self, cx: &DocContext<'_>) -> T; } impl<T: Clean<U>, U> Clean<Vec<U>> for [T] { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<U> { + fn clean(&self, cx: &DocContext<'_>) -> Vec<U> { self.iter().map(|x| x.clean(cx)).collect() } } impl<T: Clean<U>, U, V: Idx> Clean<IndexVec<V, U>> for IndexVec<V, T> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> IndexVec<V, U> { + fn clean(&self, cx: &DocContext<'_>) -> IndexVec<V, U> { self.iter().map(|x| x.clean(cx)).collect() } } impl<T: Clean<U>, U> Clean<U> for P<T> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { (**self).clean(cx) } } impl<T: Clean<U>, U> Clean<U> for Rc<T> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { (**self).clean(cx) } } impl<T: Clean<U>, U> Clean<Option<U>> for Option<T> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<U> { + fn clean(&self, cx: &DocContext<'_>) -> Option<U> { self.as_ref().map(|v| v.clean(cx)) } } impl<T, U> Clean<U> for ty::Binder<T> where T: Clean<U> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { self.skip_binder().clean(cx) } } impl<T: Clean<U>, U> Clean<Vec<U>> for P<[T]> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<U> { + fn clean(&self, cx: &DocContext<'_>) -> Vec<U> { self.iter().map(|x| x.clean(cx)).collect() } } @@ -139,8 +139,8 @@ pub struct Crate { pub masked_crates: FxHashSet<CrateNum>, } -impl<'a, 'tcx, 'rcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Crate { +impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> { + fn clean(&self, cx: &DocContext<'_>) -> Crate { use crate::visit_lib::LibEmbargoVisitor; { @@ -234,7 +234,7 @@ pub struct ExternalCrate { } impl Clean<ExternalCrate> for CrateNum { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> ExternalCrate { + fn clean(&self, cx: &DocContext<'_>) -> ExternalCrate { let root = DefId { krate: *self, index: CRATE_DEF_INDEX }; let krate_span = cx.tcx.def_span(root); let krate_src = cx.sess().source_map().span_to_filename(krate_span); @@ -582,7 +582,7 @@ pub struct Module { } impl Clean<Item> for doctree::Module { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let name = if self.name.is_some() { self.name.expect("No name provided").clean(cx) } else { @@ -1023,7 +1023,7 @@ impl AttributesExt for Attributes { } impl Clean<Attributes> for [ast::Attribute] { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Attributes { + fn clean(&self, cx: &DocContext<'_>) -> Attributes { Attributes::from_ast(cx.sess().diagnostic(), self) } } @@ -1035,7 +1035,7 @@ pub enum GenericBound { } impl GenericBound { - fn maybe_sized(cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn maybe_sized(cx: &DocContext<'_>) -> GenericBound { let did = cx.tcx.require_lang_item(lang_items::SizedTraitLangItem); let empty = cx.tcx.intern_substs(&[]); let path = external_path(cx, &cx.tcx.item_name(did).as_str(), @@ -1052,7 +1052,7 @@ impl GenericBound { }, hir::TraitBoundModifier::Maybe) } - fn is_sized_bound(&self, cx: &DocContext<'_, '_, '_>) -> bool { + fn is_sized_bound(&self, cx: &DocContext<'_>) -> bool { use rustc::hir::TraitBoundModifier as TBM; if let GenericBound::TraitBound(PolyTrait { ref trait_, .. }, TBM::None) = *self { if trait_.def_id() == cx.tcx.lang_items().sized_trait() { @@ -1078,7 +1078,7 @@ impl GenericBound { } impl Clean<GenericBound> for hir::GenericBound { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { match *self { hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)), hir::GenericBound::Trait(ref t, modifier) => { @@ -1088,7 +1088,7 @@ impl Clean<GenericBound> for hir::GenericBound { } } -fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option<DefId>, has_self: bool, +fn external_generic_args(cx: &DocContext<'_>, trait_did: Option<DefId>, has_self: bool, bindings: Vec<TypeBinding>, substs: SubstsRef<'_>) -> GenericArgs { let lifetimes = substs.regions().filter_map(|v| v.clean(cx)).collect(); let types = substs.types().skip(has_self as usize).collect::<Vec<_>>(); @@ -1130,7 +1130,7 @@ fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option<DefId>, // trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar // from Fn<(A, B,), C> to Fn(A, B) -> C -fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option<DefId>, has_self: bool, +fn external_path(cx: &DocContext<'_>, name: &str, trait_did: Option<DefId>, has_self: bool, bindings: Vec<TypeBinding>, substs: SubstsRef<'_>) -> Path { Path { global: false, @@ -1143,7 +1143,7 @@ fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option<DefI } impl<'a, 'tcx> Clean<GenericBound> for (&'a ty::TraitRef<'tcx>, Vec<TypeBinding>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { let (trait_ref, ref bounds) = *self; inline::record_extern_fqn(cx, trait_ref.def_id, TypeKind::Trait); let path = external_path(cx, &cx.tcx.item_name(trait_ref.def_id).as_str(), @@ -1187,13 +1187,13 @@ impl<'a, 'tcx> Clean<GenericBound> for (&'a ty::TraitRef<'tcx>, Vec<TypeBinding> } impl<'tcx> Clean<GenericBound> for ty::TraitRef<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { (self, vec![]).clean(cx) } } impl<'tcx> Clean<Option<Vec<GenericBound>>> for InternalSubsts<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<Vec<GenericBound>> { + fn clean(&self, cx: &DocContext<'_>) -> Option<Vec<GenericBound>> { let mut v = Vec::new(); v.extend(self.regions().filter_map(|r| r.clean(cx)).map(GenericBound::Outlives)); v.extend(self.types().map(|t| GenericBound::TraitBound(PolyTrait { @@ -1220,7 +1220,7 @@ impl Lifetime { } impl Clean<Lifetime> for hir::Lifetime { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, cx: &DocContext<'_>) -> Lifetime { if self.hir_id != hir::DUMMY_HIR_ID { let def = cx.tcx.named_region(self.hir_id); match def { @@ -1239,7 +1239,7 @@ impl Clean<Lifetime> for hir::Lifetime { } impl Clean<Lifetime> for hir::GenericParam { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, _: &DocContext<'_>) -> Lifetime { match self.kind { hir::GenericParamKind::Lifetime { .. } => { if self.bounds.len() > 0 { @@ -1263,7 +1263,7 @@ impl Clean<Lifetime> for hir::GenericParam { } impl Clean<Constant> for hir::ConstArg { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Constant { + fn clean(&self, cx: &DocContext<'_>) -> Constant { Constant { type_: cx.tcx.type_of(cx.tcx.hir().body_owner_def_id(self.value.body)).clean(cx), expr: print_const_expr(cx, self.value.body), @@ -1272,13 +1272,13 @@ impl Clean<Constant> for hir::ConstArg { } impl<'tcx> Clean<Lifetime> for ty::GenericParamDef { - fn clean(&self, _cx: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, _cx: &DocContext<'_>) -> Lifetime { Lifetime(self.name.to_string()) } } impl Clean<Option<Lifetime>> for ty::RegionKind { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<Lifetime> { + fn clean(&self, cx: &DocContext<'_>) -> Option<Lifetime> { match *self { ty::ReStatic => Some(Lifetime::statik()), ty::ReLateBound(_, ty::BrNamed(_, name)) => Some(Lifetime(name.to_string())), @@ -1307,7 +1307,7 @@ pub enum WherePredicate { } impl Clean<WherePredicate> for hir::WherePredicate { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { match *self { hir::WherePredicate::BoundPredicate(ref wbp) => { WherePredicate::BoundPredicate { @@ -1334,7 +1334,7 @@ impl Clean<WherePredicate> for hir::WherePredicate { } impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<WherePredicate> { + fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> { use rustc::ty::Predicate; match *self { @@ -1353,7 +1353,7 @@ impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> { } impl<'a> Clean<WherePredicate> for ty::TraitPredicate<'a> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { WherePredicate::BoundPredicate { ty: self.trait_ref.self_ty().clean(cx), bounds: vec![self.trait_ref.clean(cx)] @@ -1362,7 +1362,7 @@ impl<'a> Clean<WherePredicate> for ty::TraitPredicate<'a> { } impl<'tcx> Clean<WherePredicate> for ty::SubtypePredicate<'tcx> { - fn clean(&self, _cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, _cx: &DocContext<'_>) -> WherePredicate { panic!("subtype predicates are an internal rustc artifact \ and should not be seen by rustdoc") } @@ -1371,7 +1371,7 @@ impl<'tcx> Clean<WherePredicate> for ty::SubtypePredicate<'tcx> { impl<'tcx> Clean<Option<WherePredicate>> for ty::OutlivesPredicate<ty::Region<'tcx>,ty::Region<'tcx>> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<WherePredicate> { + fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> { let ty::OutlivesPredicate(ref a, ref b) = *self; match (a, b) { @@ -1389,7 +1389,7 @@ impl<'tcx> Clean<Option<WherePredicate>> for } impl<'tcx> Clean<Option<WherePredicate>> for ty::OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<WherePredicate> { + fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> { let ty::OutlivesPredicate(ref ty, ref lt) = *self; match lt { @@ -1405,7 +1405,7 @@ impl<'tcx> Clean<Option<WherePredicate>> for ty::OutlivesPredicate<Ty<'tcx>, ty: } impl<'tcx> Clean<WherePredicate> for ty::ProjectionPredicate<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { WherePredicate::EqPredicate { lhs: self.projection_ty.clean(cx), rhs: self.ty.clean(cx) @@ -1414,7 +1414,7 @@ impl<'tcx> Clean<WherePredicate> for ty::ProjectionPredicate<'tcx> { } impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { let trait_ = match self.trait_ref(cx.tcx).clean(cx) { GenericBound::TraitBound(t, _) => t.trait_, GenericBound::Outlives(_) => panic!("cleaning a trait got a lifetime"), @@ -1462,7 +1462,7 @@ impl GenericParamDef { } impl<'tcx> Clean<GenericParamDef> for ty::GenericParamDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericParamDef { + fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef { let (name, kind) = match self.kind { ty::GenericParamDefKind::Lifetime => { (self.name.to_string(), GenericParamDefKind::Lifetime) @@ -1495,7 +1495,7 @@ impl<'tcx> Clean<GenericParamDef> for ty::GenericParamDef { } impl Clean<GenericParamDef> for hir::GenericParam { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericParamDef { + fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef { let (name, kind) = match self.kind { hir::GenericParamKind::Lifetime { .. } => { let name = if self.bounds.len() > 0 { @@ -1545,7 +1545,7 @@ pub struct Generics { } impl Clean<Generics> for hir::Generics { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Generics { + fn clean(&self, cx: &DocContext<'_>) -> Generics { // Synthetic type-parameters are inserted after normal ones. // In order for normal parameters to be able to refer to synthetic ones, // scans them first. @@ -1615,7 +1615,7 @@ impl Clean<Generics> for hir::Generics { impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, &'a Lrc<ty::GenericPredicates<'tcx>>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Generics { + fn clean(&self, cx: &DocContext<'_>) -> Generics { use self::WherePredicate as WP; let (gens, preds) = *self; @@ -1702,7 +1702,7 @@ pub struct Method { } impl<'a> Clean<Method> for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Method { + fn clean(&self, cx: &DocContext<'_>) -> Method { let (generics, decl) = enter_impl_trait(cx, || { (self.1.clean(cx), (&*self.0.decl, self.2).clean(cx)) }); @@ -1729,7 +1729,7 @@ pub struct Function { } impl Clean<Item> for doctree::Function { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let (generics, decl) = enter_impl_trait(cx, || { (self.generics.clean(cx), (&self.decl, self.body).clean(cx)) }); @@ -1800,7 +1800,7 @@ pub struct Arguments { } impl<'a> Clean<Arguments> for (&'a [hir::Ty], &'a [ast::Ident]) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Arguments { + fn clean(&self, cx: &DocContext<'_>) -> Arguments { Arguments { values: self.0.iter().enumerate().map(|(i, ty)| { let mut name = self.1.get(i).map(|ident| ident.to_string()) @@ -1818,7 +1818,7 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty], &'a [ast::Ident]) { } impl<'a> Clean<Arguments> for (&'a [hir::Ty], hir::BodyId) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Arguments { + fn clean(&self, cx: &DocContext<'_>) -> Arguments { let body = cx.tcx.hir().body(self.1); Arguments { @@ -1835,7 +1835,7 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty], hir::BodyId) { impl<'a, A: Copy> Clean<FnDecl> for (&'a hir::FnDecl, A) where (&'a [hir::Ty], A): Clean<Arguments> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { + fn clean(&self, cx: &DocContext<'_>) -> FnDecl { FnDecl { inputs: (&self.0.inputs[..], self.1).clean(cx), output: self.0.output.clean(cx), @@ -1845,7 +1845,7 @@ impl<'a, A: Copy> Clean<FnDecl> for (&'a hir::FnDecl, A) } impl<'a, 'tcx> Clean<FnDecl> for (DefId, ty::PolyFnSig<'tcx>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { + fn clean(&self, cx: &DocContext<'_>) -> FnDecl { let (did, sig) = *self; let mut names = if cx.tcx.hir().as_local_hir_id(did).is_some() { vec![].into_iter() @@ -1905,7 +1905,7 @@ pub enum FunctionRetTy { } impl Clean<FunctionRetTy> for hir::FunctionRetTy { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FunctionRetTy { + fn clean(&self, cx: &DocContext<'_>) -> FunctionRetTy { match *self { hir::Return(ref typ) => Return(typ.clean(cx)), hir::DefaultReturn(..) => DefaultReturn, @@ -1934,7 +1934,7 @@ pub struct Trait { } impl Clean<Item> for doctree::Trait { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let attrs = self.attrs.clean(cx); let is_spotlight = attrs.has_doc_flag("spotlight"); Item { @@ -1965,7 +1965,7 @@ pub struct TraitAlias { } impl Clean<Item> for doctree::TraitAlias { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let attrs = self.attrs.clean(cx); Item { name: Some(self.name.clean(cx)), @@ -1984,7 +1984,7 @@ impl Clean<Item> for doctree::TraitAlias { } impl Clean<bool> for hir::IsAuto { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> bool { + fn clean(&self, _: &DocContext<'_>) -> bool { match *self { hir::IsAuto::Yes => true, hir::IsAuto::No => false, @@ -1993,13 +1993,13 @@ impl Clean<bool> for hir::IsAuto { } impl Clean<Type> for hir::TraitRef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { resolve_type(cx, self.path.clean(cx), self.hir_ref_id) } } impl Clean<PolyTrait> for hir::PolyTraitRef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> PolyTrait { + fn clean(&self, cx: &DocContext<'_>) -> PolyTrait { PolyTrait { trait_: self.trait_ref.clean(cx), generic_params: self.bound_generic_params.clean(cx) @@ -2008,7 +2008,7 @@ impl Clean<PolyTrait> for hir::PolyTraitRef { } impl Clean<Item> for hir::TraitItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::TraitItemKind::Const(ref ty, default) => { AssociatedConstItem(ty.clean(cx), @@ -2046,7 +2046,7 @@ impl Clean<Item> for hir::TraitItem { } impl Clean<Item> for hir::ImplItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::ImplItemKind::Const(ref ty, expr) => { AssociatedConstItem(ty.clean(cx), @@ -2079,7 +2079,7 @@ impl Clean<Item> for hir::ImplItem { } impl<'tcx> Clean<Item> for ty::AssociatedItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.kind { ty::AssociatedKind::Const => { let ty = cx.tcx.type_of(self.def_id); @@ -2524,7 +2524,7 @@ impl From<ast::FloatTy> for PrimitiveType { } impl Clean<Type> for hir::Ty { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { use rustc::hir::*; match self.node { @@ -2726,7 +2726,7 @@ impl Clean<Type> for hir::Ty { } impl<'tcx> Clean<Type> for Ty<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { match self.sty { ty::Never => Never, ty::Bool => Primitive(PrimitiveType::Bool), @@ -2921,7 +2921,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> { } impl Clean<Item> for hir::StructField { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); Item { @@ -2938,7 +2938,7 @@ impl Clean<Item> for hir::StructField { } impl<'tcx> Clean<Item> for ty::FieldDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.ident.name).clean(cx), attrs: cx.tcx.get_attrs(self.did).clean(cx), @@ -2961,7 +2961,7 @@ pub enum Visibility { } impl Clean<Option<Visibility>> for hir::Visibility { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<Visibility> { + fn clean(&self, cx: &DocContext<'_>) -> Option<Visibility> { Some(match self.node { hir::VisibilityKind::Public => Visibility::Public, hir::VisibilityKind::Inherited => Visibility::Inherited, @@ -2976,7 +2976,7 @@ impl Clean<Option<Visibility>> for hir::Visibility { } impl Clean<Option<Visibility>> for ty::Visibility { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Option<Visibility> { + fn clean(&self, _: &DocContext<'_>) -> Option<Visibility> { Some(if *self == ty::Visibility::Public { Public } else { Inherited }) } } @@ -2998,7 +2998,7 @@ pub struct Union { } impl Clean<Item> for doctree::Struct { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3018,7 +3018,7 @@ impl Clean<Item> for doctree::Struct { } impl Clean<Item> for doctree::Union { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3048,7 +3048,7 @@ pub struct VariantStruct { } impl Clean<VariantStruct> for ::rustc::hir::VariantData { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> VariantStruct { + fn clean(&self, cx: &DocContext<'_>) -> VariantStruct { VariantStruct { struct_type: doctree::struct_type_from_def(self), fields: self.fields().iter().map(|x| x.clean(cx)).collect(), @@ -3065,7 +3065,7 @@ pub struct Enum { } impl Clean<Item> for doctree::Enum { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3089,7 +3089,7 @@ pub struct Variant { } impl Clean<Item> for doctree::Variant { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3106,7 +3106,7 @@ impl Clean<Item> for doctree::Variant { } impl<'tcx> Clean<Item> for ty::VariantDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let kind = match self.ctor_kind { CtorKind::Const => VariantKind::CLike, CtorKind::Fn => { @@ -3154,7 +3154,7 @@ pub enum VariantKind { } impl Clean<VariantKind> for hir::VariantData { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> VariantKind { + fn clean(&self, cx: &DocContext<'_>) -> VariantKind { if self.is_struct() { VariantKind::Struct(self.clean(cx)) } else if self.is_unit() { @@ -3185,7 +3185,7 @@ impl Span { } impl Clean<Span> for syntax_pos::Span { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Span { + fn clean(&self, cx: &DocContext<'_>) -> Span { if self.is_dummy() { return Span::empty(); } @@ -3218,7 +3218,7 @@ impl Path { } impl Clean<Path> for hir::Path { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Path { + fn clean(&self, cx: &DocContext<'_>) -> Path { Path { global: self.is_global(), def: self.def, @@ -3241,7 +3241,7 @@ pub enum GenericArgs { } impl Clean<GenericArgs> for hir::GenericArgs { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericArgs { + fn clean(&self, cx: &DocContext<'_>) -> GenericArgs { if self.parenthesized { let output = self.bindings[0].ty.clean(cx); GenericArgs::Parenthesized { @@ -3283,7 +3283,7 @@ pub struct PathSegment { } impl Clean<PathSegment> for hir::PathSegment { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> PathSegment { + fn clean(&self, cx: &DocContext<'_>) -> PathSegment { PathSegment { name: self.ident.name.clean(cx), args: self.with_generic_args(|generic_args| generic_args.clean(cx)) @@ -3355,21 +3355,21 @@ fn qpath_to_string(p: &hir::QPath) -> String { impl Clean<String> for Ident { #[inline] - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, cx: &DocContext<'_>) -> String { self.name.clean(cx) } } impl Clean<String> for ast::Name { #[inline] - fn clean(&self, _: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, _: &DocContext<'_>) -> String { self.to_string() } } impl Clean<String> for InternedString { #[inline] - fn clean(&self, _: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, _: &DocContext<'_>) -> String { self.to_string() } } @@ -3381,7 +3381,7 @@ pub struct Typedef { } impl Clean<Item> for doctree::Typedef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3405,7 +3405,7 @@ pub struct Existential { } impl Clean<Item> for doctree::Existential { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3431,7 +3431,7 @@ pub struct BareFunctionDecl { } impl Clean<BareFunctionDecl> for hir::BareFnTy { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> BareFunctionDecl { + fn clean(&self, cx: &DocContext<'_>) -> BareFunctionDecl { let (generic_params, decl) = enter_impl_trait(cx, || { (self.generic_params.clean(cx), (&*self.decl, &self.arg_names[..]).clean(cx)) }); @@ -3455,7 +3455,7 @@ pub struct Static { } impl Clean<Item> for doctree::Static { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { debug!("cleaning static {}: {:?}", self.name.clean(cx), self); Item { name: Some(self.name.clean(cx)), @@ -3481,7 +3481,7 @@ pub struct Constant { } impl Clean<Item> for doctree::Constant { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3505,7 +3505,7 @@ pub enum Mutability { } impl Clean<Mutability> for hir::Mutability { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Mutability { + fn clean(&self, _: &DocContext<'_>) -> Mutability { match self { &hir::MutMutable => Mutable, &hir::MutImmutable => Immutable, @@ -3520,7 +3520,7 @@ pub enum ImplPolarity { } impl Clean<ImplPolarity> for hir::ImplPolarity { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> ImplPolarity { + fn clean(&self, _: &DocContext<'_>) -> ImplPolarity { match self { &hir::ImplPolarity::Positive => ImplPolarity::Positive, &hir::ImplPolarity::Negative => ImplPolarity::Negative, @@ -3542,7 +3542,7 @@ pub struct Impl { } pub fn get_auto_traits_with_hir_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: hir::HirId, name: String ) -> Vec<Item> { @@ -3551,7 +3551,7 @@ pub fn get_auto_traits_with_hir_id( } pub fn get_auto_traits_with_def_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: DefId ) -> Vec<Item> { let finder = AutoTraitFinder::new(cx); @@ -3560,7 +3560,7 @@ pub fn get_auto_traits_with_def_id( } pub fn get_blanket_impls_with_hir_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: hir::HirId, name: String ) -> Vec<Item> { @@ -3569,7 +3569,7 @@ pub fn get_blanket_impls_with_hir_id( } pub fn get_blanket_impls_with_def_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: DefId ) -> Vec<Item> { let finder = BlanketImplFinder::new(cx); @@ -3578,7 +3578,7 @@ pub fn get_blanket_impls_with_def_id( } impl Clean<Vec<Item>> for doctree::Impl { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<Item> { + fn clean(&self, cx: &DocContext<'_>) -> Vec<Item> { let mut ret = Vec::new(); let trait_ = self.trait_.clean(cx); let items = self.items.clean(cx); @@ -3620,7 +3620,7 @@ impl Clean<Vec<Item>> for doctree::Impl { } } -fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, +fn build_deref_target_impls(cx: &DocContext<'_>, items: &[Item], ret: &mut Vec<Item>) { use self::PrimitiveType::*; @@ -3679,7 +3679,7 @@ fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, } impl Clean<Vec<Item>> for doctree::ExternCrate { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<Item> { + fn clean(&self, cx: &DocContext<'_>) -> Vec<Item> { let please_inline = self.vis.node.is_pub() && self.attrs.iter().any(|a| { a.name() == "doc" && match a.meta_item_list() { @@ -3715,7 +3715,7 @@ impl Clean<Vec<Item>> for doctree::ExternCrate { } impl Clean<Vec<Item>> for doctree::Import { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<Item> { + fn clean(&self, cx: &DocContext<'_>) -> Vec<Item> { // We consider inlining the documentation of `pub use` statements, but we // forcefully don't inline if this is not public or if the // #[doc(no_inline)] attribute is present. @@ -3789,7 +3789,7 @@ pub struct ImportSource { } impl Clean<Vec<Item>> for hir::ForeignMod { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec<Item> { + fn clean(&self, cx: &DocContext<'_>) -> Vec<Item> { let mut items = self.items.clean(cx); for item in &mut items { if let ForeignFunctionItem(ref mut f) = item.inner { @@ -3801,7 +3801,7 @@ impl Clean<Vec<Item>> for hir::ForeignMod { } impl Clean<Item> for hir::ForeignItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::ForeignItemKind::Fn(ref decl, ref names, ref generics) => { let (generics, decl) = enter_impl_trait(cx, || { @@ -3848,11 +3848,11 @@ impl Clean<Item> for hir::ForeignItem { // Utilities pub trait ToSource { - fn to_src(&self, cx: &DocContext<'_, '_, '_>) -> String; + fn to_src(&self, cx: &DocContext<'_>) -> String; } impl ToSource for syntax_pos::Span { - fn to_src(&self, cx: &DocContext<'_, '_, '_>) -> String { + fn to_src(&self, cx: &DocContext<'_>) -> String { debug!("converting span {:?} to snippet", self.clean(cx)); let sn = match cx.sess().source_map().span_to_snippet(*self) { Ok(x) => x, @@ -3899,7 +3899,7 @@ fn name_from_pat(p: &hir::Pat) -> String { } } -fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { +fn print_const(cx: &DocContext<'_>, n: ty::LazyConst<'_>) -> String { match n { ty::LazyConst::Unevaluated(def_id, _) => { if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(def_id) { @@ -3921,12 +3921,12 @@ fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { } } -fn print_const_expr(cx: &DocContext<'_, '_, '_>, body: hir::BodyId) -> String { +fn print_const_expr(cx: &DocContext<'_>, body: hir::BodyId) -> String { cx.tcx.hir().hir_to_pretty_string(body.hir_id) } /// Given a type Path, resolve it to a Type using the TyCtxt -fn resolve_type(cx: &DocContext<'_, '_, '_>, +fn resolve_type(cx: &DocContext<'_>, path: Path, id: hir::HirId) -> Type { if id == hir::DUMMY_HIR_ID { @@ -3957,7 +3957,7 @@ fn resolve_type(cx: &DocContext<'_, '_, '_>, ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic } } -pub fn register_def(cx: &DocContext<'_, '_, '_>, def: Def) -> DefId { +pub fn register_def(cx: &DocContext<'_>, def: Def) -> DefId { debug!("register_def({:?})", def); let (did, kind) = match def { @@ -3992,7 +3992,7 @@ pub fn register_def(cx: &DocContext<'_, '_, '_>, def: Def) -> DefId { did } -fn resolve_use_source(cx: &DocContext<'_, '_, '_>, path: Path) -> ImportSource { +fn resolve_use_source(cx: &DocContext<'_>, path: Path) -> ImportSource { ImportSource { did: if path.def.opt_def_id().is_none() { None @@ -4010,7 +4010,7 @@ pub struct Macro { } impl Clean<Item> for doctree::Macro { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let name = self.name.clean(cx); Item { name: Some(name.clone()), @@ -4039,7 +4039,7 @@ pub struct ProcMacro { } impl Clean<Item> for doctree::ProcMacro { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -4073,7 +4073,7 @@ pub struct Deprecation { } impl Clean<Stability> for attr::Stability { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Stability { + fn clean(&self, _: &DocContext<'_>) -> Stability { Stability { level: stability::StabilityLevel::from_attr_level(&self.level), feature: Some(self.feature.to_string()).filter(|f| !f.is_empty()), @@ -4100,13 +4100,13 @@ impl Clean<Stability> for attr::Stability { } impl<'a> Clean<Stability> for &'a attr::Stability { - fn clean(&self, dc: &DocContext<'_, '_, '_>) -> Stability { + fn clean(&self, dc: &DocContext<'_>) -> Stability { (**self).clean(dc) } } impl Clean<Deprecation> for attr::Deprecation { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Deprecation { + fn clean(&self, _: &DocContext<'_>) -> Deprecation { Deprecation { since: self.since.map(|s| s.to_string()).filter(|s| !s.is_empty()), note: self.note.map(|n| n.to_string()).filter(|n| !n.is_empty()), @@ -4122,7 +4122,7 @@ pub struct TypeBinding { } impl Clean<TypeBinding> for hir::TypeBinding { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> TypeBinding { + fn clean(&self, cx: &DocContext<'_>) -> TypeBinding { TypeBinding { name: self.ident.name.clean(cx), ty: self.ty.clean(cx) @@ -4131,7 +4131,7 @@ impl Clean<TypeBinding> for hir::TypeBinding { } pub fn def_id_to_path( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, did: DefId, name: Option<String> ) -> Vec<String> { @@ -4148,7 +4148,7 @@ pub fn def_id_to_path( once(crate_name).chain(relative).collect() } -pub fn enter_impl_trait<F, R>(cx: &DocContext<'_, '_, '_>, f: F) -> R +pub fn enter_impl_trait<F, R>(cx: &DocContext<'_>, f: F) -> R where F: FnOnce() -> R, { |
