mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
Fix Clippy warnings (#647)
This commit is contained in:
parent
9eabb061aa
commit
72f2aeaab6
@ -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,
|
// 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
|
// see https://github.com/ClementTsang/bottom/issues/419 for details). As such, check
|
||||||
// it like this instead.
|
// 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 {
|
vec_disks.push(DiskHarvest {
|
||||||
free_space: Some(usage.free().get::<heim::units::information::byte>()),
|
free_space: Some(usage.free().get::<heim::units::information::byte>()),
|
||||||
used_space: Some(usage.used().get::<heim::units::information::byte>()),
|
used_space: Some(usage.used().get::<heim::units::information::byte>()),
|
||||||
|
@ -438,8 +438,8 @@ impl ProcColumn {
|
|||||||
if mapping.enabled {
|
if mapping.enabled {
|
||||||
Some(format!(
|
Some(format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
column_type.to_string(),
|
column_type,
|
||||||
command_str.as_str(),
|
command_str,
|
||||||
if proc_sorting_type == column_type {
|
if proc_sorting_type == column_type {
|
||||||
if sort_reverse {
|
if sort_reverse {
|
||||||
DOWN_ARROW
|
DOWN_ARROW
|
||||||
|
@ -678,10 +678,8 @@ impl Painter {
|
|||||||
self.widget_layout
|
self.widget_layout
|
||||||
.rows
|
.rows
|
||||||
.iter()
|
.iter()
|
||||||
.map(|row| &row.children)
|
.flat_map(|row| &row.children)
|
||||||
.flatten()
|
.flat_map(|col| &col.children)
|
||||||
.map(|col| &col.children)
|
|
||||||
.flatten()
|
|
||||||
.zip(self.derived_widget_draw_locs.iter().flatten().flatten())
|
.zip(self.derived_widget_draw_locs.iter().flatten().flatten())
|
||||||
.for_each(|(widgets, widget_draw_locs)| {
|
.for_each(|(widgets, widget_draw_locs)| {
|
||||||
self.draw_widgets_with_constraints(
|
self.draw_widgets_with_constraints(
|
||||||
|
@ -189,7 +189,7 @@ impl DiskTableWidget for Painter {
|
|||||||
if temp_title_base.len() > draw_loc.width as usize {
|
if temp_title_base.len() > draw_loc.width as usize {
|
||||||
(
|
(
|
||||||
" Disk ".to_string(),
|
" Disk ".to_string(),
|
||||||
format!("{}{}", " Disk ".to_string(), ESCAPE_ENDING),
|
format!("{}{}", " Disk ", ESCAPE_ENDING),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(title_base, temp_title_base)
|
(title_base, temp_title_base)
|
||||||
|
@ -254,7 +254,7 @@ impl ProcessTableWidget for Painter {
|
|||||||
if temp_title_base.len() > draw_loc.width as usize {
|
if temp_title_base.len() > draw_loc.width as usize {
|
||||||
(
|
(
|
||||||
" Processes ".to_string(),
|
" Processes ".to_string(),
|
||||||
format!("{}{}", " Processes ".to_string(), ESCAPE_ENDING),
|
format!("{}{}", " Processes ", ESCAPE_ENDING),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(title_base, temp_title_base)
|
(title_base, temp_title_base)
|
||||||
|
@ -178,7 +178,7 @@ impl TempTableWidget for Painter {
|
|||||||
if temp_title_base.len() > draw_loc.width as usize {
|
if temp_title_base.len() > draw_loc.width as usize {
|
||||||
(
|
(
|
||||||
" Temperatures ".to_string(),
|
" Temperatures ".to_string(),
|
||||||
format!("{}{}", " Temperatures ".to_string(), ESCAPE_ENDING),
|
format!("{}{}", " Temperatures ", ESCAPE_ENDING),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(title_base, temp_title_base)
|
(title_base, temp_title_base)
|
||||||
|
@ -37,11 +37,11 @@ pub struct Config {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn get_config_as_bytes(&self) -> anyhow::Result<Vec<u8>> {
|
pub fn get_config_as_bytes(&self) -> anyhow::Result<Vec<u8>> {
|
||||||
let mut config_string: Vec<Cow<'_, str>> = Vec::default();
|
let config_string: Vec<Cow<'_, str>> = vec![
|
||||||
|
// Top level
|
||||||
// Top level
|
CONFIG_TOP_HEAD.into(),
|
||||||
config_string.push(CONFIG_TOP_HEAD.into());
|
toml::to_string_pretty(self)?.into(),
|
||||||
config_string.push(toml::to_string_pretty(self)?.into());
|
];
|
||||||
|
|
||||||
Ok(config_string.concat().as_bytes().to_vec())
|
Ok(config_string.concat().as_bytes().to_vec())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user