Skip to content

Commit 867e346

Browse files
committed
respect RUSTFMT
Signed-off-by: onur-ozkan <[email protected]>
1 parent c96cbeb commit 867e346

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/cargo-fmt/main.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ fn execute() -> i32 {
150150
}
151151

152152
fn rustfmt_command() -> Command {
153-
let rustfmt = env::current_exe()
154-
.expect("current executable path invalid")
155-
.with_file_name("rustfmt");
153+
let rustfmt = match env::var_os("RUSTFMT") {
154+
Some(rustfmt) => PathBuf::from(rustfmt),
155+
None => env::current_exe()
156+
.expect("current executable path invalid")
157+
.with_file_name("rustfmt"),
158+
};
156159

157160
Command::new(rustfmt)
158161
}

0 commit comments

Comments
 (0)