Skip to content

Commit f8e2cef

Browse files
committed
Move intra-doc link checks to a separate function.
1 parent 6718ea1 commit f8e2cef

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/tools/linkchecker/main.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,23 @@ impl Checker {
365365
}
366366
});
367367

368+
self.check_intra_doc_links(file, &pretty_path, &source, report);
369+
370+
// we don't need the source anymore,
371+
// so drop to reduce memory-usage
372+
match self.cache.get_mut(&pretty_path).unwrap() {
373+
FileEntry::HtmlFile { source, .. } => *source = Rc::new(String::new()),
374+
_ => unreachable!("must be html file"),
375+
}
376+
}
377+
378+
fn check_intra_doc_links(
379+
&mut self,
380+
file: &Path,
381+
pretty_path: &str,
382+
source: &str,
383+
report: &mut Report,
384+
) {
368385
// Search for intra-doc links that rustdoc didn't warn about
369386
// FIXME(#77199, 77200) Rustdoc should just warn about these directly.
370387
// NOTE: only looks at one line at a time; in practice this should find most links
@@ -379,12 +396,6 @@ impl Checker {
379396
}
380397
}
381398
}
382-
// we don't need the source anymore,
383-
// so drop to reduce memory-usage
384-
match self.cache.get_mut(&pretty_path).unwrap() {
385-
FileEntry::HtmlFile { source, .. } => *source = Rc::new(String::new()),
386-
_ => unreachable!("must be html file"),
387-
}
388399
}
389400

390401
/// Load a file from disk, or from the cache if available.

0 commit comments

Comments
 (0)