From 92acf286e81f0d092340f692bd86831b0ed19563 Mon Sep 17 00:00:00 2001 From: Vladimir Markelov Date: Sun, 17 Nov 2024 17:06:09 -0800 Subject: [PATCH] clippy fixes --- src/conf.rs | 2 +- src/fmt.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conf.rs b/src/conf.rs index e8a28cb..a359f2d 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -1438,7 +1438,7 @@ fn is_id_range(s: &str) -> bool { if s.find(|c: char| !c.is_ascii_digit() && c != '-' && c != ':').is_some() { return false; } - s.contains(|c: char| c == '-' || c == ':') + s.contains(['-', ':']) } fn color_from_str(s: &str) -> Result { diff --git a/src/fmt.rs b/src/fmt.rs index 9578de0..2e69027 100644 --- a/src/fmt.rs +++ b/src/fmt.rs @@ -1295,19 +1295,19 @@ fn field_width_cached(field: &str, fields: &[String], cached: &[usize]) -> usize } fn is_hashtag(s: &str) -> bool { - !s.contains(|c| c == ' ' || c == '\t' || c == '\n' || c == '\r') && s.len() > 1 && s.starts_with('#') + !s.contains([' ', '\t', '\n', '\r']) && s.len() > 1 && s.starts_with('#') } fn is_project(s: &str) -> bool { - !s.contains(|c| c == ' ' || c == '\t' || c == '\n' || c == '\r') && s.len() > 1 && s.starts_with('+') + !s.contains([' ', '\t', '\n', '\r']) && s.len() > 1 && s.starts_with('+') } fn is_context(s: &str) -> bool { - !s.contains(|c| c == ' ' || c == '\t' || c == '\n' || c == '\r') && s.len() > 1 && s.starts_with('@') + !s.contains([' ', '\t', '\n', '\r']) && s.len() > 1 && s.starts_with('@') } fn is_tag(s: &str) -> bool { - if s.contains(|c| c == ' ' || c == '\t' || c == '\n' || c == '\r') { + if s.contains([' ', '\t', '\n', '\r']) { return false; } match s.find(':') { @@ -1322,7 +1322,7 @@ fn is_syntax_word(s: &str) -> bool { fn parse_subj(subj: &str) -> Vec<&str> { let mut parts: Vec<&str> = Vec::new(); - if !subj.contains(|c| c == ':' || c == '@' || c == '+' || c == '#') { + if !subj.contains([':', '@', '+', '#']) { parts.push(subj); return parts; } @@ -1330,7 +1330,7 @@ fn parse_subj(subj: &str) -> Vec<&str> { let mut part = subj; let mut part_len = 0; loop { - match curr.find(|c| c == ' ' || c == '\n' || c == '\r') { + match curr.find([' ', '\n', '\r']) { Some(pos) => { if is_syntax_word(&curr[..pos]) { if part_len == 0 {