Skip to content

Commit 626d028

Browse files
committed
1 parent 1e88dba commit 626d028

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/oxc_diagnostics/src/service.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn from_file_path<A: AsRef<Path>>(path: A) -> Option<String> {
330330
fn strict_canonicalize<P: AsRef<Path>>(path: P) -> std::io::Result<PathBuf> {
331331
use std::io;
332332

333-
fn impl_(path: PathBuf) -> std::io::Result<PathBuf> {
333+
fn impl_(path: &Path) -> std::io::Result<PathBuf> {
334334
let head = path.components().next().ok_or(io::Error::other("empty path"))?;
335335
let disk_;
336336
let head = if let std::path::Component::Prefix(prefix) = head {
@@ -350,7 +350,7 @@ fn strict_canonicalize<P: AsRef<Path>>(path: P) -> std::io::Result<PathBuf> {
350350
}
351351

352352
let canon = std::fs::canonicalize(path)?;
353-
impl_(canon)
353+
impl_(&canon)
354354
}
355355

356356
#[cfg(test)]
@@ -366,6 +366,9 @@ mod tests {
366366
#[test]
367367
#[cfg(windows)]
368368
fn test_idempotent_canonicalization() {
369+
use crate::service::strict_canonicalize;
370+
use std::path::Path;
371+
369372
let lhs = strict_canonicalize(Path::new(".")).unwrap();
370373
let rhs = strict_canonicalize(&lhs).unwrap();
371374
assert_eq!(lhs, rhs);
@@ -416,7 +419,7 @@ mod tests {
416419
];
417420

418421
for (path, expected) in paths.iter().zip(expected) {
419-
let uri = Uri::from_file_path(path).unwrap();
422+
let uri = from_file_path(path).unwrap();
420423
assert_eq!(uri.to_string(), expected);
421424
}
422425
}

0 commit comments

Comments
 (0)