From 626d0283a339eafee3750449db19238b8c64285d Mon Sep 17 00:00:00 2001 From: Sysix <3897725+Sysix@users.noreply.github.com> Date: Fri, 27 Jun 2025 15:47:53 +0000 Subject: [PATCH] test(linter): fix windows uri tests (#11943) https://github.com/oxc-project/oxc/actions/runs/15927318422/job/44927541870 obsolete: #11942 --- crates/oxc_diagnostics/src/service.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/oxc_diagnostics/src/service.rs b/crates/oxc_diagnostics/src/service.rs index 35bda164883e6..03c51da4c2489 100644 --- a/crates/oxc_diagnostics/src/service.rs +++ b/crates/oxc_diagnostics/src/service.rs @@ -330,7 +330,7 @@ fn from_file_path>(path: A) -> Option { fn strict_canonicalize>(path: P) -> std::io::Result { use std::io; - fn impl_(path: PathBuf) -> std::io::Result { + fn impl_(path: &Path) -> std::io::Result { let head = path.components().next().ok_or(io::Error::other("empty path"))?; let disk_; let head = if let std::path::Component::Prefix(prefix) = head { @@ -350,7 +350,7 @@ fn strict_canonicalize>(path: P) -> std::io::Result { } let canon = std::fs::canonicalize(path)?; - impl_(canon) + impl_(&canon) } #[cfg(test)] @@ -366,6 +366,9 @@ mod tests { #[test] #[cfg(windows)] fn test_idempotent_canonicalization() { + use crate::service::strict_canonicalize; + use std::path::Path; + let lhs = strict_canonicalize(Path::new(".")).unwrap(); let rhs = strict_canonicalize(&lhs).unwrap(); assert_eq!(lhs, rhs); @@ -416,7 +419,7 @@ mod tests { ]; for (path, expected) in paths.iter().zip(expected) { - let uri = Uri::from_file_path(path).unwrap(); + let uri = from_file_path(path).unwrap(); assert_eq!(uri.to_string(), expected); } }