test: refactor function name
MODIFY
Cargo.lock
Cargo.lock
@@ -1479,7 +1479,6 @@ name = "rome_cli"
version = "0.0.0"
dependencies = [
"anyhow",
- "cfg-if",
"crossbeam",
"dashmap",
"hdrhistogram",

MODIFY
crates/rome_cli/Cargo.toml
crates/rome_cli/Cargo.toml
@@ -33,7 +33,6 @@ serde = { version = "1.0.133", features = ["derive"] }
serde_json = { version = "1.0.74" }
tokio = { version = "1.15.0", features = ["io-std", "io-util", "net", "time", "rt", "rt-multi-thread", "macros"] }
anyhow = "1.0.52"
-cfg-if = "1.0.0"
dashmap = "5.2.0"
[target.'cfg(unix)'.dependencies]

MODIFY
crates/rome_cli/src/termination.rs
crates/rome_cli/src/termination.rs
@@ -70,17 +70,10 @@ pub enum Termination {
}
fn command_name() -> String {
- #[allow(unused_assignments)]
- let mut command = current_exe()
+ current_exe()
.ok()
.and_then(|path| Some(path.file_name()?.to_str()?.to_string()))
- .unwrap_or_else(|| String::from("rome"));
- cfg_if::cfg_if! {
- if #[cfg(debug_assertions)] {
- command = String::from("rome")
- }
- }
- command
+ .unwrap_or_else(|| String::from("rome"))
}
// Termination implements Debug by redirecting to Display instead of deriving

MODIFY
crates/rome_cli/tests/snap_test.rs
crates/rome_cli/tests/snap_test.rs
@@ -4,6 +4,7 @@ use rome_console::{markup, BufferConsole, Markup};
use rome_diagnostics::termcolor::NoColor;
use rome_fs::{FileSystemExt, MemoryFileSystem};
use std::collections::HashMap;
+use std::env::current_exe;
use std::fmt::Write as _;
use std::path::PathBuf;
@@ -76,10 +77,19 @@ impl CliSnapshot {
}
if let Some(termination) = &self.termination {
+ let mut message = format!("{:?}", termination);
+ let exe = current_exe()
+ .ok()
+ .and_then(|path| Some(path.file_name()?.to_str()?.to_string()));
+ if let Some(exe) = exe {
+ if message.contains(&exe) {
+ message = message.replace(&exe, "rome");
+ }
+ }
content.push_str("# Termination Message\n\n");
content.push_str("```block");
content.push('\n');
- let _ = write!(content, "{:?}", termination);
+ let _ = write!(content, "{}", message);
content.push('\n');
content.push_str("```");
content.push_str("\n\n");

test: refactor function name (#3203)