diff options
| author | Johann Hemmann <johann.hemmann@code.berlin> | 2024-01-19 15:02:06 +0100 |
|---|---|---|
| committer | Johann Hemmann <johann.hemmann@code.berlin> | 2024-01-19 17:31:01 +0100 |
| commit | 2ae25123788fdd1f0892b3a6fc103cacc17f7759 (patch) | |
| tree | b073251a393f9ce07c81ceff4b5a7c8fb662bc27 | |
| parent | c27b6b53089a31c358c9e565218f0796444d39cd (diff) | |
| download | rust-2ae25123788fdd1f0892b3a6fc103cacc17f7759.tar.gz rust-2ae25123788fdd1f0892b3a6fc103cacc17f7759.zip | |
if_same_then_else
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/rust-analyzer/src/handlers/request.rs | 15 |
2 files changed, 7 insertions, 9 deletions
diff --git a/Cargo.toml b/Cargo.toml index 9fd58325368..18ed8a162b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -174,7 +174,6 @@ derived_hash_with_manual_eq = "allow" field_reassign_with_default = "allow" forget_non_drop = "allow" format_collect = "allow" -if_same_then_else = "allow" large_enum_variant = "allow" match_like_matches_macro = "allow" match_single_binding = "allow" diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs index 4b2a1f7e8ef..f3c2df24d95 100644 --- a/crates/rust-analyzer/src/handlers/request.rs +++ b/crates/rust-analyzer/src/handlers/request.rs @@ -1978,14 +1978,13 @@ fn run_rustfmt( // approach: if the command name contains a path separator, join it with the workspace root. // however, if the path is absolute, joining will result in the absolute path being preserved. // as a fallback, rely on $PATH-based discovery. - let cmd_path = - if cfg!(windows) && command.contains([std::path::MAIN_SEPARATOR, '/']) { - spec.workspace_root.join(cmd).into() - } else if command.contains(std::path::MAIN_SEPARATOR) { - spec.workspace_root.join(cmd).into() - } else { - cmd - }; + let cmd_path = if command.contains(std::path::MAIN_SEPARATOR) + || (cfg!(windows) && command.contains('/')) + { + spec.workspace_root.join(cmd).into() + } else { + cmd + }; process::Command::new(cmd_path) } None => process::Command::new(cmd), |
