From c9cb3280f365621d724d4f07a8dc96b325a107c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 7 Jun 2024 14:07:02 +0200 Subject: [PATCH] Address review comments --- src/tools/compiletest/src/runtest.rs | 2 +- tests/run-make/c-link-to-rust-dylib/rmake.rs | 2 +- tests/run-make/const-prop-lint/rmake.rs | 4 ++-- tests/run-make/notify-all-emit-artifacts/rmake.rs | 6 +++--- tests/run-make/rustdoc-scrape-examples-macros/rmake.rs | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c50dd2d5a99..6d4b50a9238 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3463,7 +3463,7 @@ fn run_rmake_v2_test(&self) { // to the `rmake_out` directory. for path in walkdir::WalkDir::new(&self.testpaths.file).min_depth(1) { let path = path.unwrap().path().to_path_buf(); - if path.file_name().map(|s| s != OsStr::new("rmake.rs")).unwrap_or(false) { + if path.file_name().is_some_and(|s| s != "rmake.rs") { let target = rmake_out_dir.join(path.strip_prefix(&self.testpaths.file).unwrap()); if path.is_dir() { copy_dir_all(&path, target).unwrap(); diff --git a/tests/run-make/c-link-to-rust-dylib/rmake.rs b/tests/run-make/c-link-to-rust-dylib/rmake.rs index 37a326099d2..ec42e88032d 100644 --- a/tests/run-make/c-link-to-rust-dylib/rmake.rs +++ b/tests/run-make/c-link-to-rust-dylib/rmake.rs @@ -21,7 +21,7 @@ fn main() { run("bar"); let expected_extension = dynamic_lib_extension(); - read_dir(std::env::current_dir().unwrap(), |path| { + read_dir(cwd(), |path| { if path.is_file() && path.extension().is_some_and(|ext| ext == expected_extension) && path.file_name().and_then(|name| name.to_str()).is_some_and(|name| { diff --git a/tests/run-make/const-prop-lint/rmake.rs b/tests/run-make/const-prop-lint/rmake.rs index c2d3e1ab136..6d0069a84d7 100644 --- a/tests/run-make/const-prop-lint/rmake.rs +++ b/tests/run-make/const-prop-lint/rmake.rs @@ -2,12 +2,12 @@ use std::fs; -use run_make_support::rustc; +use run_make_support::{cwd, rustc}; fn main() { rustc().input("input.rs").run_fail_assert_exit_code(1); - for entry in fs::read_dir(std::env::current_dir().unwrap()).unwrap() { + for entry in fs::read_dir(cwd()).unwrap() { let entry = entry.unwrap(); let path = entry.path(); diff --git a/tests/run-make/notify-all-emit-artifacts/rmake.rs b/tests/run-make/notify-all-emit-artifacts/rmake.rs index 6d966793c35..1c2e08ca8f5 100644 --- a/tests/run-make/notify-all-emit-artifacts/rmake.rs +++ b/tests/run-make/notify-all-emit-artifacts/rmake.rs @@ -6,7 +6,7 @@ // See extern crate run_make_support; -use run_make_support::rustc; +use run_make_support::{cwd, rustc}; fn main() { // With single codegen unit files are renamed to match the source file name @@ -17,7 +17,7 @@ fn main() { .codegen_units(1) .json("artifacts") .error_format("json") - .incremental(&std::env::current_dir().unwrap()) + .incremental(cwd()) .run(); let stderr = String::from_utf8_lossy(&output.stderr); for file in &["lib.o", "lib.ll", "lib.bc", "lib.s"] { @@ -33,7 +33,7 @@ fn main() { .codegen_units(2) .json("artifacts") .error_format("json") - .incremental(&std::env::current_dir().unwrap()) + .incremental(cwd()) .run(); let stderr = String::from_utf8_lossy(&output.stderr); for file in &["rcgu.o", "rcgu.ll", "rcgu.bc", "rcgu.s"] { diff --git a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs index 2daaab76e54..c99112b6e5f 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs @@ -1,6 +1,6 @@ //@ ignore-cross-compile -use run_make_support::{htmldocck, rustc, rustdoc}; +use run_make_support::{htmldocck, rustc, rustdoc, rust_lib_name}; fn main() { let out_dir = "rustdoc"; @@ -40,7 +40,7 @@ fn main() { .crate_name("ex") .crate_type("bin") .output(&out_dir) - .extern_(crate_name, format!("lib{crate_name}.rlib")) + .extern_(crate_name, rust_lib_name(crate_name)) .extern_(proc_crate_name, dylib_name.trim()) .arg("-Zunstable-options") .arg("--scrape-examples-output-path")