mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-07-09 06:01:04 +00:00
refactor: small cleanup of some string formatting (#2130)
Some quick random refactors I spotted while looking at something else.
This commit is contained in:
@@ -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
@@ -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())
|
||||
|
||||
@@ -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!(),
|
||||
|
||||
Reference in New Issue
Block a user