refactor: small cleanup of some string formatting (#2130)

Some quick random refactors I spotted while looking at something else.
This commit is contained in:
Clement Tsang
2026-07-07 04:34:08 -04:00
committed by GitHub
parent f170988a24
commit 9fc30ac2ff
3 changed files with 5 additions and 11 deletions
@@ -990,13 +990,7 @@ mod tests {
(actual, expected) => {
if actual.area != expected.area {
panic!(
indoc::indoc!(
"
buffer areas not equal
expected: {:?}
actual: {:?}"
),
expected, actual
"buffer areas not equal - expected: {expected:?} - actual: {actual:?}",
);
}
let diff = expected.diff(&actual);
+3 -4
View File
@@ -235,20 +235,19 @@ pub(crate) fn get_or_create_config(config_path: Option<&Path>) -> anyhow::Result
match create_config_at_path(path) {
Ok(cfg) => Ok(cfg),
Err(err) => {
let path = path.display();
if config_path.is_some() {
Err(err.context(format!(
"bottom could not create a new config file at '{}'.",
path.display()
"bottom could not create a new config file at '{path}'.",
)))
} else {
indoc::eprintdoc!(
"Note: bottom couldn't create a default config file at '{}', and the \
"Note: bottom couldn't create a default config file at '{path}', and the \
application has fallen back to the default configuration.
Caused by:
{err}
",
path.display()
);
Ok(Config::default())
+1
View File
@@ -23,6 +23,7 @@ const TEMPLATE: &str = indoc! {
const USAGE: &str = "btm [OPTIONS]";
// Can't use an unwrap here at the moment since it's const.
const VERSION: &str = match option_env!("NIGHTLY_VERSION") {
Some(nightly_version) => nightly_version,
None => crate_version!(),