summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app.rs8
-rw-r--r--src/app/layout_manager.rs10
-rw-r--r--src/app/query.rs6
-rw-r--r--src/canvas/drawing_utils.rs5
-rw-r--r--src/lib.rs15
5 files changed, 21 insertions, 23 deletions
diff --git a/src/app.rs b/src/app.rs
index 33141fe2..38a3a8ae 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -210,10 +210,10 @@ impl App {
}
pub fn is_in_search_widget(&self) -> bool {
- match self.current_widget.widget_type {
- BottomWidgetType::ProcSearch => true,
- _ => false,
- }
+ matches!(
+ self.current_widget.widget_type,
+ BottomWidgetType::ProcSearch
+ )
}
fn reset_multi_tap_keys(&mut self) {
diff --git a/src/app/layout_manager.rs b/src/app/layout_manager.rs
index 9ce89d7c..abd998d2 100644
--- a/src/app/layout_manager.rs
+++ b/src/app/layout_manager.rs
@@ -887,18 +887,12 @@ pub enum BottomWidgetType {
impl BottomWidgetType {
pub fn is_widget_table(&self) -> bool {
use BottomWidgetType::*;
- match self {
- Disk | Proc | ProcSort | Temp | CpuLegend => true,
- _ => false,
- }
+ matches!(self, Disk | Proc | ProcSort | Temp | CpuLegend)
}
pub fn is_widget_graph(&self) -> bool {
use BottomWidgetType::*;
- match self {
- Cpu | Net | Mem => true,
- _ => false,
- }
+ matches!(self, Cpu | Net | Mem)
}
pub fn get_pretty_name(&self) -> &str {
diff --git a/src/app/query.rs b/src/app/query.rs
index 25e3f409..488749a4 100644
--- a/src/app/query.rs
+++ b/src/app/query.rs
@@ -669,7 +669,11 @@ impl Prefix {
} else if let Some((prefix_type, query_content)) = &self.regex_prefix {
if let StringQuery::Regex(r) = query_content {
match prefix_type {
- PrefixType::Name => r.is_match(process.name.as_str()),
+ PrefixType::Name => r.is_match(if is_using_command {
+ process.command.as_str()
+ } else {
+ process.name.as_str()
+ }),
PrefixType::Pid => r.is_match(process.pid.to_string().as_str()),
PrefixType::State => r.is_match(process.process_state.as_str()),
_ => true,
diff --git a/src/canvas/drawing_utils.rs b/src/canvas/drawing_utils.rs
index 283d8538..22d56419 100644
--- a/src/canvas/drawing_utils.rs
+++ b/src/canvas/drawing_utils.rs
@@ -19,11 +19,10 @@ pub fn get_variable_intrinsic_widths(
let mut remaining_width = (total_width - (num_widths as u16 - 1)) as i32; // Required for spaces...
let desired_widths = desired_widths_ratio
.iter()
- .map(|&desired_width_ratio| (desired_width_ratio * total_width as f64) as i32)
- .collect::<Vec<_>>();
+ .map(|&desired_width_ratio| (desired_width_ratio * total_width as f64) as i32);
for (desired_width, resulting_width, width_threshold) in izip!(
- desired_widths.into_iter(),
+ desired_widths,
resulting_widths.iter_mut(),
width_thresholds
) {
diff --git a/src/lib.rs b/src/lib.rs
index daeaffc0..5ae55bb4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -418,15 +418,16 @@ pub fn handle_force_redraws(app: &mut App) {
}
}
+#[allow(clippy::needless_collect)]
pub fn update_all_process_lists(app: &mut App) {
- let widget_ids = app
- .proc_state
- .widget_states
- .keys()
- .cloned()
- .collect::<Vec<_>>();
-
if !app.is_frozen {
+ let widget_ids = app
+ .proc_state
+ .widget_states
+ .keys()
+ .cloned()
+ .collect::<Vec<_>>();
+
widget_ids.into_iter().for_each(|widget_id| {
update_final_process_list(app, widget_id);
});