Skip to content

Commit ba10a4c

Browse files
author
Rob Tsuk
committed
Canonicalise the paths
1 parent 53dcb0d commit ba10a4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cargo-fmt/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@ fn get_targets(strategy: &CargoFmtStrategy) -> Result<HashSet<Target>, io::Error
249249

250250
fn get_targets_root_only(targets: &mut HashSet<Target>) -> Result<(), io::Error> {
251251
let metadata = get_cargo_metadata(None)?;
252-
let current_dir = env::current_dir()?;
252+
let current_dir = env::current_dir()?.canonicalize()?;
253253
let current_dir_manifest = current_dir.join("Cargo.toml");
254-
let workspace_root_path = PathBuf::from(&metadata.workspace_root);
254+
let workspace_root_path = PathBuf::from(&metadata.workspace_root).canonicalize()?;
255255
let in_workspace_root = workspace_root_path == current_dir;
256256

257257
for package in metadata.packages {

0 commit comments

Comments
 (0)