diff options
author | Canop <cano.petrole@gmail.com> | 2021-05-07 10:45:04 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-05-07 10:45:04 +0200 |
commit | 8593028c16d899b5b69dec45ac860d252d18af66 (patch) | |
tree | 39c3c2171d69e1d92f6bdb1fcbcea354a13ee0e9 /src | |
parent | 6c4b5ced881851ab38e65061c46ea0760ed9c384 (diff) |
new rust version, new clippy
Mostly for the good, this time.
I'm just not very happy with being asked to add a hard
to read `!is_empty()`.
Diffstat (limited to 'src')
-rw-r--r-- | src/display/git_status_display.rs | 2 | ||||
-rw-r--r-- | src/file_sum/mod.rs | 2 | ||||
-rw-r--r-- | src/image/image_view.rs | 2 | ||||
-rw-r--r-- | src/kitty/image_renderer.rs | 2 | ||||
-rw-r--r-- | src/pattern/tok_pattern.rs | 18 | ||||
-rw-r--r-- | src/verb/invocation_parser.rs | 2 |
6 files changed, 12 insertions, 16 deletions
diff --git a/src/display/git_status_display.rs b/src/display/git_status_display.rs index fdca713..fd2e775 100644 --- a/src/display/git_status_display.rs +++ b/src/display/git_status_display.rs @@ -42,8 +42,8 @@ impl<'a, 's> GitStatusDisplay<'a, 's> { status, skin, show_branch, - show_stats, show_wide, + show_stats, width, } } diff --git a/src/file_sum/mod.rs b/src/file_sum/mod.rs index db7714c..92abf3c 100644 --- a/src/file_sum/mod.rs +++ b/src/file_sum/mod.rs @@ -43,7 +43,7 @@ impl FileSum { count: usize, modified: u32, ) -> Self { - Self { real_size, sparse, count, modified } + Self { real_size, count, modified, sparse } } pub fn zero() -> Self { diff --git a/src/image/image_view.rs b/src/image/image_view.rs index f91a4b0..f6a3f10 100644 --- a/src/image/image_view.rs +++ b/src/image/image_view.rs @@ -98,9 +98,9 @@ impl ImageView { self.source_img.resize(target_width, target_height, FilterType::Triangle), ); self.display_img = Some(CachedImage { + img, target_width, target_height, - img, }); &self.display_img.as_ref().unwrap().img } diff --git a/src/kitty/image_renderer.rs b/src/kitty/image_renderer.rs index f26ab3a..06f1a51 100644 --- a/src/kitty/image_renderer.rs +++ b/src/kitty/image_renderer.rs @@ -129,8 +129,8 @@ impl<'i> KittyImage<'i> { let data = src.into(); let id = renderer.new_id(); Self { - data, id, + data, img_width, img_height, area, diff --git a/src/pattern/tok_pattern.rs b/src/pattern/tok_pattern.rs index a3c743f..0aef5b7 100644 --- a/src/pattern/tok_pattern.rs +++ b/src/pattern/tok_pattern.rs @@ -45,12 +45,10 @@ impl TokPattern { // separator of the whole. This allows using the // other char: In ";ab,er", the comma isn't seen // as a separator but as part of a tok - let sep = pattern.chars() - .filter(|c| SEPARATORS.contains(c)) - .next(); + let sep = pattern.chars().find(|c| SEPARATORS.contains(c)); let mut toks: Vec<Box<[char]>> = if let Some(sep) = sep { pattern.split(sep) - .filter(|s| s.len() > 0) + .filter(|s| !s.is_empty()) .map(norm_chars) .collect() } else { @@ -92,10 +90,9 @@ impl TokPattern { let l = first_tok.len(); let first_matching_range = (0..cand_chars.len()+1-l) .map(|idx| idx..idx+l) - .filter(|r| { + .find(|r| { &cand_chars[r.start..r.end] == first_tok.as_ref() - }) - .next(); + }); // we initialize the vec only when the first tok is found first_matching_range .and_then(|first_matching_range| { @@ -107,7 +104,7 @@ impl TokPattern { .filter(|r| { &cand_chars[r.start..r.end] == tok.as_ref() }) - .filter(|r| { + .find(|r| { // check we're not intersecting a previous range for pr in &matching_ranges { if pr.contains(&r.start) || pr.contains(&(r.end-1)) { @@ -115,8 +112,7 @@ impl TokPattern { } } true - }) - .next(); + }); if let Some(r) = matching_range { matching_ranges.push(r); } else { @@ -143,7 +139,7 @@ impl TokPattern { i += 1; } } - pos.sort(); + pos.sort_unstable(); let score = self.score_of_matching(candidate); NameMatch { score, pos } }) diff --git a/src/verb/invocation_parser.rs b/src/verb/invocation_parser.rs index 30ebafe..dc849ef 100644 --- a/src/verb/invocation_parser.rs +++ b/src/verb/invocation_parser.rs @@ -71,8 +71,8 @@ impl InvocationParser { Ok(Self { invocation_pattern, args_parser, - arg_selection_type, arg_anchor, + arg_selection_type, }) } |