diff options
| author | Eric Huss <eric@huss.org> | 2022-11-03 22:01:58 -0700 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2022-11-03 22:01:58 -0700 |
| commit | f8e2cef5faa7ff77e91ea2d0416006f0b7aa52bf (patch) | |
| tree | 5fb1125ba8a0cc0ffbf827be0aff9f180325fe75 /src | |
| parent | 6718ea1cff98da785c10079cac1c1ecc30c12d52 (diff) | |
| download | rust-f8e2cef5faa7ff77e91ea2d0416006f0b7aa52bf.tar.gz rust-f8e2cef5faa7ff77e91ea2d0416006f0b7aa52bf.zip | |
Move intra-doc link checks to a separate function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/linkchecker/main.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 7842611bd4f..4092722501d 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -365,6 +365,23 @@ impl Checker { } }); + self.check_intra_doc_links(file, &pretty_path, &source, report); + + // we don't need the source anymore, + // so drop to reduce memory-usage + match self.cache.get_mut(&pretty_path).unwrap() { + FileEntry::HtmlFile { source, .. } => *source = Rc::new(String::new()), + _ => unreachable!("must be html file"), + } + } + + fn check_intra_doc_links( + &mut self, + file: &Path, + pretty_path: &str, + source: &str, + report: &mut Report, + ) { // Search for intra-doc links that rustdoc didn't warn about // FIXME(#77199, 77200) Rustdoc should just warn about these directly. // NOTE: only looks at one line at a time; in practice this should find most links @@ -379,12 +396,6 @@ impl Checker { } } } - // we don't need the source anymore, - // so drop to reduce memory-usage - match self.cache.get_mut(&pretty_path).unwrap() { - FileEntry::HtmlFile { source, .. } => *source = Rc::new(String::new()), - _ => unreachable!("must be html file"), - } } /// Load a file from disk, or from the cache if available. |
