We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 79758ac + df98ac2 commit 198e4c4Copy full SHA for 198e4c4
1 file changed
src/tools/rust-analyzer/crates/rust-analyzer/src/handlers/request.rs
@@ -2442,8 +2442,7 @@ fn run_rustfmt(
2442
}
2443
RustfmtConfig::CustomCommand { command, args } => {
2444
let cmd = Utf8PathBuf::from(&command);
2445
- let target_spec =
2446
- crates.first().and_then(|&crate_id| snap.target_spec_for_file(file_id, crate_id));
+ let target_spec = TargetSpec::for_file(snap, file_id).ok().flatten();
2447
let extra_env = snap.config.extra_env(source_root_id);
2448
let mut cmd = match target_spec {
2449
Some(TargetSpec::Cargo(_)) => {
0 commit comments