diff options
| -rw-r--r-- | src/bootstrap/test.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 10 | ||||
| -rw-r--r-- | src/librustdoc/theme.rs | 2 | ||||
| -rw-r--r-- | src/tools/rustdoc-themes/test-themes.py | 10 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 1c6cd066ad9..351d10df28d 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -451,7 +451,9 @@ impl Step for RustdocTheme { fn run(self, builder: &Builder) { let rustdoc = builder.rustdoc(self.compiler.host); let mut cmd = Command::new(builder.config.python.clone().expect("python not defined")); - cmd.args(&["src/tools/rustdoc-themes/test-themes.py", rustdoc.to_str().unwrap()]); + cmd.args(&[builder.src.join("src/tools/rustdoc-themes/test-themes.py").to_str().unwrap(), + rustdoc.to_str().unwrap(), + builder.src.join("src/librustdoc/html/static/themes").to_str().unwrap()]); cmd.env("RUSTC_STAGE", self.compiler.stage.to_string()) .env("RUSTC_SYSROOT", builder.sysroot(self.compiler)) .env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host)) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 17cf2b7349b..a72026c7d6b 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -332,10 +332,10 @@ pub fn main_args(args: &[String]) -> isize { print!(" - Checking \"{}\"...", theme_file); let (success, differences) = theme::test_theme_against(theme_file, &paths); if !differences.is_empty() || !success { - eprintln!(" FAILED"); + println!(" FAILED"); errors += 1; if !differences.is_empty() { - eprintln!("{}", differences.join("\n")); + println!("{}", differences.join("\n")); } } else { println!(" OK"); @@ -407,13 +407,13 @@ pub fn main_args(args: &[String]) -> isize { .iter() .map(|s| (PathBuf::from(&s), s.to_owned())) { if !theme_file.is_file() { - eprintln!("rustdoc: option --themes arguments must all be files"); + println!("rustdoc: option --themes arguments must all be files"); return 1; } let (success, ret) = theme::test_theme_against(&theme_file, &paths); if !success || !ret.is_empty() { - eprintln!("rustdoc: invalid theme: \"{}\"", theme_s); - eprintln!(" Check what's wrong with the \"theme-checker\" option"); + println!("rustdoc: invalid theme: \"{}\"", theme_s); + println!(" Check what's wrong with the \"theme-checker\" option"); return 1; } themes.push(theme_file); diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs index 39c9a6e2aa4..1e4f64f5c52 100644 --- a/src/librustdoc/theme.rs +++ b/src/librustdoc/theme.rs @@ -348,7 +348,7 @@ c // sdf d {} "#; let paths = load_css_paths(text.as_bytes()); - assert!(paths.children.get(&CssPath::new("a b c d".to_owned())).is_some()); + assert!(paths.children.contains(&CssPath::new("a b c d".to_owned()))); } #[test] diff --git a/src/tools/rustdoc-themes/test-themes.py b/src/tools/rustdoc-themes/test-themes.py index 27756e3bef6..31591277ce3 100644 --- a/src/tools/rustdoc-themes/test-themes.py +++ b/src/tools/rustdoc-themes/test-themes.py @@ -17,7 +17,6 @@ import subprocess import sys FILES_TO_IGNORE = ['main.css'] -THEME_DIR_PATH = "src/librustdoc/html/static/themes" def print_err(msg): @@ -31,14 +30,15 @@ def exec_command(command): def main(argv): - if len(argv) < 1: + if len(argv) < 2: print_err("Needs rustdoc binary path") return 1 rustdoc_bin = argv[0] - themes = [join(THEME_DIR_PATH, f) for f in listdir(THEME_DIR_PATH) - if isfile(join(THEME_DIR_PATH, f)) and f not in FILES_TO_IGNORE] + themes_folder = argv[1] + themes = [join(themes_folder, f) for f in listdir(themes_folder) + if isfile(join(themes_folder, f)) and f not in FILES_TO_IGNORE] if len(themes) < 1: - print_err('No theme found in "{}"...'.format(THEME_DIR_PATH)) + print_err('No theme found in "{}"...'.format(themes_folder)) return 1 args = [rustdoc_bin, '-Z', 'unstable-options', '--theme-checker'] args.extend(themes) |
