From f3e4279ccc39f097f659f6e8eaf314e9e4da523e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 24 May 2019 10:39:49 +0200 Subject: [PATCH] Apply review comments --- src/doc/rustdoc/src/command-line-arguments.md | 4 ++-- src/librustdoc/config.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index 9bbb396323d..2c25baf373e 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -371,8 +371,8 @@ $ rustdoc src/lib.rs --themes /path/to/your/theme/file.css ### `theme-checker`: check if your themes implement all the required rules This flag allows you to check if your themes implement the necessary CSS rules. To put it more -simply, when adding a new theme, it needs to implements all the CSS rules present in the `ðark` and -`light` CSS themes. +simply, when adding a new theme, it needs to implements all the CSS rules present in the "light" +CSS theme. You can use this flag like this: diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 853be97530b..068da1f1941 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -370,9 +370,15 @@ impl Options { return Err(1); } let (success, ret) = theme::test_theme_against(&theme_file, &paths, &diag); - if !success || !ret.is_empty() { - diag.struct_warn(&format!("invalid theme: \"{}\"", theme_s)) - .help("check what's wrong with the --theme-checker option") + if !success { + diag.struct_warn(&format!("error loading theme file: \"{}\"", theme_s)).emit(); + return Err(1); + } else if !ret.is_empty() { + diag.struct_warn(&format!("theme file \"{}\" is missing CSS rules from the \ + default theme", theme_s)) + .warn("the theme may appear incorrect when loaded") + .help(&format!("to see what rules are missing, call `rustdoc \ + --theme-checker \"{}\"`", theme_s)) .emit(); } themes.push(theme_file);