if_same_then_else

This commit is contained in:
Johann Hemmann 2024-01-19 15:02:06 +01:00
parent c27b6b5308
commit 2ae2512378
2 changed files with 7 additions and 9 deletions

View file

@ -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"

View file

@ -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),