Skip to content

Commit 2ad29eb

Browse files
bors[bot]matklad
andauthored
Merge #5668
5668: Fix relative path handling for custom rustfmt r=matklad a=matklad `current_dir` and relative paths to executables works differently on unix and windows (unix behavior does not make sense), see: https://github.com/oconnor663/duct.rs/blob/17e30e83a16b202551df4d70d0b2cc174cb53e5d/src/lib.rs#L295-L324 The original motivation to set cwd was to make rustfmt read the correct rustfmt.toml, but that was future proofing, rather than a bug fix. So, let's just remove this and see if breaks or fixes more use-cases. If support for per-file config is needed, we could use `--config-path` flag. bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents af6e9a7 + ffe4a5e commit 2ad29eb

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

crates/rust-analyzer/src/handlers.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,6 @@ pub(crate) fn handle_formatting(
709709
}
710710
};
711711

712-
if let Ok(path) = params.text_document.uri.to_file_path() {
713-
if let Some(parent) = path.parent() {
714-
rustfmt.current_dir(parent);
715-
}
716-
}
717712
let mut rustfmt = rustfmt.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn()?;
718713

719714
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;

0 commit comments

Comments
 (0)