diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 12246b0d416..7db70eb9dd8 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -865,7 +865,7 @@ struct AliasedTypeImpl<'cache> { type_aliases: Vec<(&'cache [Symbol], Item)>, } -impl<'cx, 'cache> DocVisitor for TypeImplCollector<'cx, 'cache> { +impl<'cx, 'cache> DocVisitor<'_> for TypeImplCollector<'cx, 'cache> { fn visit_item(&mut self, it: &Item) { self.visit_item_recur(it); let cache = self.cache; diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 9ba0fb7b83c..7be9cc0b885 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -103,7 +103,7 @@ fn add_local_source(&mut self, item: &clean::Item) { } } -impl DocVisitor for LocalSourcesCollector<'_, '_> { +impl DocVisitor<'_> for LocalSourcesCollector<'_, '_> { fn visit_item(&mut self, item: &clean::Item) { self.add_local_source(item); @@ -122,7 +122,7 @@ struct SourceCollector<'a, 'tcx> { crate_name: &'a str, } -impl DocVisitor for SourceCollector<'_, '_> { +impl DocVisitor<'_> for SourceCollector<'_, '_> { fn visit_item(&mut self, item: &clean::Item) { if !self.cx.include_sources { return; diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs index 15c0d77e7ba..abea5bcbc51 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -187,7 +187,7 @@ fn print_table_record( } } -impl<'a, 'b> DocVisitor for CoverageCalculator<'a, 'b> { +impl<'a, 'b> DocVisitor<'_> for CoverageCalculator<'a, 'b> { fn visit_item(&mut self, i: &clean::Item) { if !i.item_id.is_local() { // non-local items are skipped because they can be out of the users control, diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs index 52b2cd7774d..1dc9af7ebe5 100644 --- a/src/librustdoc/passes/check_doc_test_visibility.rs +++ b/src/librustdoc/passes/check_doc_test_visibility.rs @@ -34,7 +34,7 @@ pub(crate) fn check_doc_test_visibility(krate: Crate, cx: &mut DocContext<'_>) - krate } -impl<'a, 'tcx> DocVisitor for DocTestVisibilityLinter<'a, 'tcx> { +impl<'a, 'tcx> DocVisitor<'_> for DocTestVisibilityLinter<'a, 'tcx> { fn visit_item(&mut self, item: &Item) { look_for_tests(self.cx, &item.doc_value(), item); diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 29342dcac59..e95e8762b1d 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -816,7 +816,7 @@ fn is_derive_trait_collision(ns: &PerNS, ResolutionFailu } } -impl<'a, 'tcx> DocVisitor for LinkCollector<'a, 'tcx> { +impl<'a, 'tcx> DocVisitor<'_> for LinkCollector<'a, 'tcx> { fn visit_item(&mut self, item: &Item) { self.resolve_links(item); self.visit_item_recur(item) diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 949ba548387..b307e84e42e 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -229,7 +229,7 @@ struct SyntheticImplCollector<'a, 'tcx> { impls: Vec, } -impl<'a, 'tcx> DocVisitor for SyntheticImplCollector<'a, 'tcx> { +impl<'a, 'tcx> DocVisitor<'_> for SyntheticImplCollector<'a, 'tcx> { fn visit_item(&mut self, i: &Item) { if i.is_struct() || i.is_enum() || i.is_union() { // FIXME(eddyb) is this `doc(hidden)` check needed? @@ -256,7 +256,7 @@ fn new(cache: &'cache Cache) -> Self { } } -impl<'cache> DocVisitor for ItemAndAliasCollector<'cache> { +impl<'cache> DocVisitor<'_> for ItemAndAliasCollector<'cache> { fn visit_item(&mut self, i: &Item) { self.items.insert(i.item_id); diff --git a/src/librustdoc/passes/lint.rs b/src/librustdoc/passes/lint.rs index 4da5d8f0e06..593027ef7d2 100644 --- a/src/librustdoc/passes/lint.rs +++ b/src/librustdoc/passes/lint.rs @@ -25,7 +25,7 @@ pub(crate) fn run_lints(krate: Crate, cx: &mut DocContext<'_>) -> Crate { krate } -impl<'a, 'tcx> DocVisitor for Linter<'a, 'tcx> { +impl<'a, 'tcx> DocVisitor<'_> for Linter<'a, 'tcx> { fn visit_item(&mut self, item: &Item) { let Some(hir_id) = DocContext::as_local_hir_id(self.cx.tcx, item.item_id) else { // If non-local, no need to check anything. diff --git a/src/librustdoc/visit.rs b/src/librustdoc/visit.rs index f1de0fe9a34..fbc18176ed8 100644 --- a/src/librustdoc/visit.rs +++ b/src/librustdoc/visit.rs @@ -1,12 +1,12 @@ use crate::clean::*; -pub(crate) trait DocVisitor: Sized { - fn visit_item(&mut self, item: &Item) { +pub(crate) trait DocVisitor<'a>: Sized { + fn visit_item(&mut self, item: &'a Item) { self.visit_item_recur(item) } /// don't override! - fn visit_inner_recur(&mut self, kind: &ItemKind) { + fn visit_inner_recur(&mut self, kind: &'a ItemKind) { match kind { StrippedItem(..) => unreachable!(), ModuleItem(i) => { @@ -47,18 +47,18 @@ fn visit_inner_recur(&mut self, kind: &ItemKind) { } /// don't override! - fn visit_item_recur(&mut self, item: &Item) { + fn visit_item_recur(&mut self, item: &'a Item) { match &item.kind { StrippedItem(i) => self.visit_inner_recur(&*i), _ => self.visit_inner_recur(&item.kind), } } - fn visit_mod(&mut self, m: &Module) { + fn visit_mod(&mut self, m: &'a Module) { m.items.iter().for_each(|i| self.visit_item(i)) } - fn visit_crate(&mut self, c: &Crate) { + fn visit_crate(&mut self, c: &'a Crate) { self.visit_item(&c.module); for trait_ in c.external_traits.values() {