refactor: run clippy after updating to Rust 1.80 (#1502)

This commit is contained in:
Clement Tsang 2024-07-26 00:44:38 +00:00 committed by GitHub
parent 29029b86fb
commit a794cc5123
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 29 deletions

View File

@ -746,33 +746,31 @@ impl Prefix {
is_ignoring_case, is_ignoring_case,
is_searching_with_regex, is_searching_with_regex,
); );
} else if let Some((prefix_type, StringQuery::Value(regex_string))) = &mut self.regex_prefix } else if let Some((
PrefixType::Pid | PrefixType::Name | PrefixType::State | PrefixType::User,
StringQuery::Value(regex_string),
)) = &mut self.regex_prefix
{ {
match prefix_type { let escaped_regex: String;
PrefixType::Pid | PrefixType::Name | PrefixType::State | PrefixType::User => { let final_regex_string = &format!(
let escaped_regex: String; "{}{}{}{}",
let final_regex_string = &format!( if is_searching_whole_word { "^" } else { "" },
"{}{}{}{}", if is_ignoring_case { "(?i)" } else { "" },
if is_searching_whole_word { "^" } else { "" }, if !is_searching_with_regex {
if is_ignoring_case { "(?i)" } else { "" }, escaped_regex = regex::escape(regex_string);
if !is_searching_with_regex { &escaped_regex
escaped_regex = regex::escape(regex_string); } else {
&escaped_regex regex_string
} else { },
regex_string if is_searching_whole_word { "$" } else { "" },
}, );
if is_searching_whole_word { "$" } else { "" },
);
let taken_pwc = self.regex_prefix.take(); let taken_pwc = self.regex_prefix.take();
if let Some((taken_pt, _)) = taken_pwc { if let Some((taken_pt, _)) = taken_pwc {
self.regex_prefix = Some(( self.regex_prefix = Some((
taken_pt, taken_pt,
StringQuery::Regex(Regex::new(final_regex_string)?), StringQuery::Regex(Regex::new(final_regex_string)?),
)); ));
}
}
_ => {}
} }
} }

View File

@ -108,8 +108,7 @@ impl Painter {
/// Draws the process search field. /// Draws the process search field.
/// - `widget_id` represents the widget ID of the search box itself --- NOT /// - `widget_id` represents the widget ID of the search box itself --- NOT
/// the process widget /// the process widget state that is stored.
/// state that is stored.
fn draw_search_field( fn draw_search_field(
&self, f: &mut Frame<'_>, app_state: &mut App, draw_loc: Rect, draw_border: bool, &self, f: &mut Frame<'_>, app_state: &mut App, draw_loc: Rect, draw_border: bool,
widget_id: u64, widget_id: u64,
@ -313,8 +312,7 @@ impl Painter {
/// Draws the process sort box. /// Draws the process sort box.
/// - `widget_id` represents the widget ID of the sort box itself --- NOT /// - `widget_id` represents the widget ID of the sort box itself --- NOT
/// the process widget /// the process widget state that is stored.
/// state that is stored.
fn draw_sort_table( fn draw_sort_table(
&self, f: &mut Frame<'_>, app_state: &mut App, draw_loc: Rect, widget_id: u64, &self, f: &mut Frame<'_>, app_state: &mut App, draw_loc: Rect, widget_id: u64,
) { ) {