diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-05-02 17:08:50 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-05-02 17:39:48 -0400 |
commit | ecc111b21adbf1b4e40fc3317429f35ca6b8a136 (patch) | |
tree | 39f8e11756508ae518f8705e8711366ae013cdcf | |
parent | 6e81fbeebf7de91bc319b2c90cd25f18fdf288ea (diff) |
refactor: fix clippy errors
-rw-r--r-- | src/app/query.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/app/query.rs b/src/app/query.rs index cfb8a571..16a78f84 100644 --- a/src/app/query.rs +++ b/src/app/query.rs @@ -185,7 +185,7 @@ impl Prefix { pub fn check(&self, process: &ConvertedProcessData) -> bool { fn matches_condition(condition: &QueryComparison, lhs: f64, rhs: f64) -> bool { match condition { - QueryComparison::Equal => lhs == rhs, + QueryComparison::Equal => (lhs - rhs).abs() < f64::EPSILON, QueryComparison::Less => lhs < rhs, QueryComparison::Greater => lhs > rhs, QueryComparison::LessOrEqual => lhs <= rhs, diff --git a/src/main.rs b/src/main.rs index 1c99bb84..5dfc3e57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -612,20 +612,15 @@ fn update_final_process_list(app: &mut App, widget_id: u64) { app.canvas_data .process_data .iter() - .filter_map(|process| { - let mut result = true; + .filter(|process| { if !is_invalid_or_blank { - result = if let Some(process_filter) = process_filter { + if let Some(process_filter) = process_filter { process_filter.check(&process) } else { true - }; - } - - if result { - return Some(process); + } } else { - None + true } }) .cloned() |