Skip to content

Commit b4833a8

Browse files
authored
Merge pull request rust-lang#1446 from BusyJay/fix-file-lines-check
fix path check
2 parents b46c147 + c5f07ed commit b4833a8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/bin/rustfmt.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,16 @@ fn determine_operation(matches: &Matches) -> FmtResult<Operation> {
367367
});
368368
}
369369

370-
let files: Vec<_> = matches.free.iter().map(PathBuf::from).collect();
370+
let files: Vec<_> = matches
371+
.free
372+
.iter()
373+
.map(|s| {
374+
let p = PathBuf::from(s);
375+
// we will do comparison later, so here tries to canonicalize first
376+
// to get the expected behavior.
377+
p.canonicalize().unwrap_or(p)
378+
})
379+
.collect();
371380

372381
Ok(Operation::Format {
373382
files: files,

0 commit comments

Comments
 (0)