From 2ae25123788fdd1f0892b3a6fc103cacc17f7759 Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Fri, 19 Jan 2024 15:02:06 +0100 Subject: [PATCH] if_same_then_else --- Cargo.toml | 1 - crates/rust-analyzer/src/handlers/request.rs | 15 +++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9fd5832536..18ed8a162b 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 4b2a1f7e8e..f3c2df24d9 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),