about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Middleton <olliemail27@gmail.com>2016-06-02 13:33:21 +0100
committerOliver Middleton <olliemail27@gmail.com>2016-06-02 14:29:36 +0100
commit8e0baf492aeee89e927284b1bfd41c1af162ac3c (patch)
treed1606572bf84203a09e8f25b8d524dcd798d63d4
parent433d70cda2e6d61d5bbb20423f0937a643cf34b4 (diff)
downloadrust-8e0baf492aeee89e927284b1bfd41c1af162ac3c.tar.gz
rust-8e0baf492aeee89e927284b1bfd41c1af162ac3c.zip
linkchecker: Treat directory links as errors
Directory links don't work well offline so they should be treated as errors.
-rw-r--r--src/tools/linkchecker/main.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
index a7c8c01fab8..c02fc8a3f91 100644
--- a/src/tools/linkchecker/main.rs
+++ b/src/tools/linkchecker/main.rs
@@ -191,6 +191,12 @@ fn check(cache: &mut Cache,
         // exist! If it doesn't then we register and print an error.
         if path.exists() {
             if path.is_dir() {
+                // Links to directories show as directory listings when viewing
+                // the docs offline so it's best to avoid them.
+                *errors = true;
+                let pretty_path = path.strip_prefix(root).unwrap_or(&path);
+                println!("{}:{}: directory link - {}", pretty_file.display(),
+                         i + 1, pretty_path.display());
                 return;
             }
             let res = load_file(cache, root, path.clone(), FromRedirect(false));