Fix Clippy warnings ()

This commit is contained in:
Mateusz Mikuła 2021-12-28 20:31:42 +01:00 committed by GitHub
parent 9eabb061aa
commit 72f2aeaab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 15 deletions

View File

@ -127,7 +127,7 @@ pub async fn get_disk_usage(
// The usage line can fail in some cases (for example, if you use Void Linux + LUKS,
// see https://github.com/ClementTsang/bottom/issues/419 for details). As such, check
// it like this instead.
if let Ok(usage) = heim::disk::usage(partition.mount_point().to_path_buf()).await {
if let Ok(usage) = heim::disk::usage(partition.mount_point()).await {
vec_disks.push(DiskHarvest {
free_space: Some(usage.free().get::<heim::units::information::byte>()),
used_space: Some(usage.used().get::<heim::units::information::byte>()),

View File

@ -438,8 +438,8 @@ impl ProcColumn {
if mapping.enabled {
Some(format!(
"{}{}{}",
column_type.to_string(),
command_str.as_str(),
column_type,
command_str,
if proc_sorting_type == column_type {
if sort_reverse {
DOWN_ARROW

View File

@ -678,10 +678,8 @@ impl Painter {
self.widget_layout
.rows
.iter()
.map(|row| &row.children)
.flatten()
.map(|col| &col.children)
.flatten()
.flat_map(|row| &row.children)
.flat_map(|col| &col.children)
.zip(self.derived_widget_draw_locs.iter().flatten().flatten())
.for_each(|(widgets, widget_draw_locs)| {
self.draw_widgets_with_constraints(

View File

@ -189,7 +189,7 @@ impl DiskTableWidget for Painter {
if temp_title_base.len() > draw_loc.width as usize {
(
" Disk ".to_string(),
format!("{}{}", " Disk ".to_string(), ESCAPE_ENDING),
format!("{}{}", " Disk ", ESCAPE_ENDING),
)
} else {
(title_base, temp_title_base)

View File

@ -254,7 +254,7 @@ impl ProcessTableWidget for Painter {
if temp_title_base.len() > draw_loc.width as usize {
(
" Processes ".to_string(),
format!("{}{}", " Processes ".to_string(), ESCAPE_ENDING),
format!("{}{}", " Processes ", ESCAPE_ENDING),
)
} else {
(title_base, temp_title_base)

View File

@ -178,7 +178,7 @@ impl TempTableWidget for Painter {
if temp_title_base.len() > draw_loc.width as usize {
(
" Temperatures ".to_string(),
format!("{}{}", " Temperatures ".to_string(), ESCAPE_ENDING),
format!("{}{}", " Temperatures ", ESCAPE_ENDING),
)
} else {
(title_base, temp_title_base)

View File

@ -37,11 +37,11 @@ pub struct Config {
impl Config {
pub fn get_config_as_bytes(&self) -> anyhow::Result<Vec<u8>> {
let mut config_string: Vec<Cow<'_, str>> = Vec::default();
// Top level
config_string.push(CONFIG_TOP_HEAD.into());
config_string.push(toml::to_string_pretty(self)?.into());
let config_string: Vec<Cow<'_, str>> = vec![
// Top level
CONFIG_TOP_HEAD.into(),
toml::to_string_pretty(self)?.into(),
];
Ok(config_string.concat().as_bytes().to_vec())
}