diff options
| author | Integral <integral@member.fsf.org> | 2024-12-18 00:28:34 +0800 |
|---|---|---|
| committer | Integral <integral@member.fsf.org> | 2024-12-18 00:28:34 +0800 |
| commit | 7eb0d8442444897395d5ac167860f710a2842205 (patch) | |
| tree | 6866058996d0f57706f82d6c2651e1f42d07fc2e /src/tools/compiletest | |
| parent | 978c659b72ed7520332a74321dc8accf48b06d94 (diff) | |
| download | rust-7eb0d8442444897395d5ac167860f710a2842205.tar.gz rust-7eb0d8442444897395d5ac167860f710a2842205.zip | |
refactor: replace &PathBuf with &Path to enhance generality
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/debuggers.rs | 4 | ||||
| -rw-r--r-- | src/tools/compiletest/src/lib.rs | 7 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs index b605bc813f1..20e3c8dfb9e 100644 --- a/src/tools/compiletest/src/debuggers.rs +++ b/src/tools/compiletest/src/debuggers.rs @@ -1,6 +1,6 @@ use std::env; use std::ffi::OsString; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::process::Command; use std::sync::Arc; @@ -141,7 +141,7 @@ pub(crate) fn extract_cdb_version(full_version_line: &str) -> Option<[u16; 4]> { pub(crate) fn analyze_gdb( gdb: Option<String>, target: &str, - android_cross_path: &PathBuf, + android_cross_path: &Path, ) -> (Option<String>, Option<u32>) { #[cfg(not(windows))] const GDB_FALLBACK: &str = "gdb"; diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index a5a166af33b..d3b4631a212 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -598,10 +598,9 @@ pub fn collect_and_make_tests(config: Arc<Config>) -> Vec<test::TestDescAndFn> { let mut collector = TestCollector { tests: vec![], found_path_stems: HashSet::new(), poisoned: false }; - collect_tests_from_dir(&cx, &mut collector, &cx.config.src_base, &PathBuf::new()) - .unwrap_or_else(|reason| { - panic!("Could not read tests from {}: {reason}", cx.config.src_base.display()) - }); + collect_tests_from_dir(&cx, &mut collector, &cx.config.src_base, Path::new("")).unwrap_or_else( + |reason| panic!("Could not read tests from {}: {reason}", cx.config.src_base.display()), + ); let TestCollector { tests, found_path_stems, poisoned } = collector; diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 8af4325e7b1..cb31b03dd2a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2560,7 +2560,7 @@ impl<'test> TestCx<'test> { }) } - fn delete_file(&self, file: &PathBuf) { + fn delete_file(&self, file: &Path) { if !file.exists() { // Deleting a nonexistent file would error. return; |
