rm higher-ranked lifetimes from DocVisitor
This allows the visitor to borrow from the visitees.
This commit is contained in:
parent
b1745c3919
commit
4facc1ce41
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -816,7 +816,7 @@ fn is_derive_trait_collision<T>(ns: &PerNS<Result<Vec<(Res, T)>, 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)
|
||||
|
@ -229,7 +229,7 @@ struct SyntheticImplCollector<'a, 'tcx> {
|
||||
impls: Vec<Item>,
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user