other: appease clippy after Rust 1.72.0 (#1281)

* deps: use clap 4.4.0 to remove is-terminal

* fmt

* appease clippy

* fmt again

* Revert "deps: use clap 4.4.0 to remove is-terminal"

This reverts commit 78aa6ec848.
This commit is contained in:
Clement Tsang 2023-08-24 20:26:46 -04:00 committed by GitHub
parent 713b1874b7
commit e8f6d4853a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 41 deletions

View File

@ -97,7 +97,7 @@ cfg_if! {
/// 2. Is the entry denied through any filter? That is, does it match an entry in a
/// filter where `is_list_ignored` is `true`? If so, we always deny this entry.
/// 3. Anything else is allowed.
pub(self) fn keep_disk_entry(
pub fn keep_disk_entry(
disk_name: &str, mount_point: &str, disk_filter: &Option<Filter>, mount_filter: &Option<Filter>,
) -> bool {
match (disk_filter, mount_filter) {

View File

@ -318,7 +318,7 @@ fn add_thermal_zone_temperatures(
) {
let path = Path::new("/sys/class/thermal");
let Ok(read_dir) = path.read_dir() else {
return
return;
};
let mut seen_names: HashMap<String, u32> = HashMap::new();

View File

@ -328,7 +328,6 @@ pub fn parse_query(
}),
)),
});
} else {
}
}
_ => {

View File

@ -219,7 +219,7 @@ impl AppSearchState {
.next_boundary(chunk, start_position)
.unwrap();
}
_ => Err(err).unwrap(),
_ => panic!("{err:?}"),
},
}
}
@ -239,7 +239,7 @@ impl AppSearchState {
self.grapheme_cursor.prev_boundary(chunk, 0).unwrap();
}
_ => Err(err).unwrap(),
_ => panic!("{err:?}"),
},
}
}

View File

@ -448,7 +448,7 @@ pub const HELP_TEXT: [&[&str]; HELP_CONTENTS_TEXT.len()] = [
];
// Default layouts
pub const DEFAULT_LAYOUT: &str = r##"
pub const DEFAULT_LAYOUT: &str = r#"
[[row]]
ratio=30
[[row.child]]
@ -471,9 +471,9 @@ pub const DEFAULT_LAYOUT: &str = r##"
[[row.child]]
type="proc"
default=true
"##;
"#;
pub const DEFAULT_BATTERY_LAYOUT: &str = r##"
pub const DEFAULT_BATTERY_LAYOUT: &str = r#"
[[row]]
ratio=30
[[row.child]]
@ -500,13 +500,13 @@ pub const DEFAULT_BATTERY_LAYOUT: &str = r##"
[[row.child]]
type="proc"
default=true
"##;
"#;
// Config and flags
pub const DEFAULT_CONFIG_FILE_PATH: &str = "bottom/bottom.toml";
// TODO: Eventually deprecate this, or grab from a file.
pub const CONFIG_TEXT: &str = r##"# This is a default config file for bottom. All of the settings are commented
pub const CONFIG_TEXT: &str = r#"# This is a default config file for bottom. All of the settings are commented
# out by default; if you wish to change them uncomment and modify as you see
# fit.
@ -695,7 +695,7 @@ pub const CONFIG_TEXT: &str = r##"# This is a default config file for bottom. A
#regex = true
#case_sensitive = false
#whole_word = false
"##;
"#;
pub const CONFIG_TOP_HEAD: &str = r##"# This is bottom's config file.
# Values in this config file will change when changed in the interface.
@ -706,19 +706,19 @@ pub const CONFIG_TOP_HEAD: &str = r##"# This is bottom's config file.
"##;
pub const CONFIG_DISPLAY_OPTIONS_HEAD: &str = r##"
pub const CONFIG_DISPLAY_OPTIONS_HEAD: &str = r#"
# These options represent settings that affect how bottom functions.
# If a setting here corresponds to command-line flag, then the flag will temporarily override
# the setting.
"##;
"#;
pub const CONFIG_COLOUR_HEAD: &str = r##"
pub const CONFIG_COLOUR_HEAD: &str = r#"
# These options represent colour values for various parts of bottom. Note that colour support
# will ultimately depend on the terminal - for example, the Terminal for macOS does NOT like
# custom colours and it may glitch out.
"##;
"#;
pub const CONFIG_LAYOUT_HEAD: &str = r##"
pub const CONFIG_LAYOUT_HEAD: &str = r#"
# These options represent how bottom will lay out its widgets. Layouts follow a pattern like this:
# [[row]] represents a row in the application.
# [[row.child]] represents either a widget or a column.
@ -726,11 +726,11 @@ pub const CONFIG_LAYOUT_HEAD: &str = r##"
#
# All widgets must have the valid type value set to one of ["cpu", "mem", "proc", "net", "temp", "disk", "empty"].
# All layout components have a ratio value - if this is not set, then it defaults to 1.
"##;
"#;
pub const CONFIG_FILTER_HEAD: &str = r##"
pub const CONFIG_FILTER_HEAD: &str = r#"
# These options represent disabled entries for the temperature and disk widgets.
"##;
"#;
#[cfg(test)]
mod test {

View File

@ -631,7 +631,7 @@ pub fn convert_gpu_data(
let results = current_data
.gpu_harvest
.iter()
.zip(point_vec.into_iter())
.zip(point_vec)
.map(|(gpu, points)| {
let short_name = {
let last_words = gpu.0.split_whitespace().rev().take(2).collect::<Vec<_>>();

View File

@ -252,7 +252,7 @@ pub fn build_app(
if columns.is_empty() {
None
} else {
Some(IndexSet::from_iter(columns.into_iter()))
Some(IndexSet::from_iter(columns))
}
}
None => None,

View File

@ -1063,10 +1063,7 @@ mod test {
data.sort_by_key(|p| p.pid);
sort_skip_pid_asc(&ProcColumn::CpuPercent, &mut data, SortOrder::Descending);
assert_eq!(
vec![&c, &b, &a, &d]
.iter()
.map(|d| (d.pid))
.collect::<Vec<_>>(),
[&c, &b, &a, &d].iter().map(|d| (d.pid)).collect::<Vec<_>>(),
data.iter().map(|d| (d.pid)).collect::<Vec<_>>(),
);
@ -1074,20 +1071,14 @@ mod test {
data.sort_by_key(|p| p.pid);
sort_skip_pid_asc(&ProcColumn::CpuPercent, &mut data, SortOrder::Ascending);
assert_eq!(
vec![&a, &d, &b, &c]
.iter()
.map(|d| (d.pid))
.collect::<Vec<_>>(),
[&a, &d, &b, &c].iter().map(|d| (d.pid)).collect::<Vec<_>>(),
data.iter().map(|d| (d.pid)).collect::<Vec<_>>(),
);
data.sort_by_key(|p| p.pid);
sort_skip_pid_asc(&ProcColumn::MemoryPercent, &mut data, SortOrder::Descending);
assert_eq!(
vec![&b, &a, &c, &d]
.iter()
.map(|d| (d.pid))
.collect::<Vec<_>>(),
[&b, &a, &c, &d].iter().map(|d| (d.pid)).collect::<Vec<_>>(),
data.iter().map(|d| (d.pid)).collect::<Vec<_>>(),
);
@ -1095,10 +1086,7 @@ mod test {
data.sort_by_key(|p| p.pid);
sort_skip_pid_asc(&ProcColumn::MemoryPercent, &mut data, SortOrder::Ascending);
assert_eq!(
vec![&c, &d, &a, &b]
.iter()
.map(|d| (d.pid))
.collect::<Vec<_>>(),
[&c, &d, &a, &b].iter().map(|d| (d.pid)).collect::<Vec<_>>(),
data.iter().map(|d| (d.pid)).collect::<Vec<_>>(),
);
}

View File

@ -10,7 +10,7 @@ use toml_edit::de::from_str;
// TODO: Could move these into the library files rather than external tbh.
const PROC_LAYOUT: &str = r##"
const PROC_LAYOUT: &str = r#"
[[row]]
[[row.child]]
type="proc"
@ -24,7 +24,7 @@ const PROC_LAYOUT: &str = r##"
type="proc"
[[row.child]]
type="proc"
"##;
"#;
fn test_create_layout(
rows: &[Row], default_widget_id: u64, default_widget_type: Option<BottomWidgetType>,
@ -221,7 +221,7 @@ fn test_left_legend() {
#[test]
/// Tests explicit default widget.
fn test_default_widget_in_layout() {
let proc_layout = r##"
let proc_layout = r#"
[[row]]
[[row.child]]
type="proc"
@ -236,7 +236,8 @@ fn test_default_widget_in_layout() {
default=true
[[row.child]]
type="proc"
"##;
"#;
let rows = from_str::<Config>(proc_layout).unwrap().row.unwrap();
let mut iter_id = 0; // A lazy way of forcing unique IDs *shrugs*
let mut total_height_ratio = 0;