Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMarkelov committed Nov 18, 2024
1 parent 6573542 commit 92acf28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ColorSpec> {
Expand Down
12 changes: 6 additions & 6 deletions src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(':') {
Expand All @@ -1322,15 +1322,15 @@ 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;
}
let mut curr = subj;
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 {
Expand Down

0 comments on commit 92acf28

Please sign in to comment.