Apply review comments

This commit is contained in:
Guillaume Gomez 2019-05-24 10:39:49 +02:00
parent dcccd28e42
commit f3e4279ccc
2 changed files with 11 additions and 5 deletions

View File

@ -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:

View File

@ -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);