Skip to content

Commit fb42dae

Browse files
Simplify CSS parser to check themes
1 parent c815756 commit fb42dae

File tree

2 files changed

+178
-207
lines changed

2 files changed

+178
-207
lines changed

src/librustdoc/config.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,13 @@ impl Options {
412412

413413
let to_check = matches.opt_strs("check-theme");
414414
if !to_check.is_empty() {
415-
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
415+
let paths = match theme::load_css_paths(static_files::themes::LIGHT) {
416+
Ok(p) => p,
417+
Err(e) => {
418+
diag.struct_err(&e.to_string()).emit();
419+
return Err(1);
420+
}
421+
};
416422
let mut errors = 0;
417423

418424
println!("rustdoc: [check-theme] Starting tests! (Ignoring all other arguments)");
@@ -547,7 +553,13 @@ impl Options {
547553

548554
let mut themes = Vec::new();
549555
if matches.opt_present("theme") {
550-
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
556+
let paths = match theme::load_css_paths(static_files::themes::LIGHT) {
557+
Ok(p) => p,
558+
Err(e) => {
559+
diag.struct_err(&e.to_string()).emit();
560+
return Err(1);
561+
}
562+
};
551563

552564
for (theme_file, theme_s) in
553565
matches.opt_strs("theme").iter().map(|s| (PathBuf::from(&s), s.to_owned()))

0 commit comments

Comments
 (0)