From 26e7d9767e3175fd49096cc3e051c5e351f896f0 Mon Sep 17 00:00:00 2001 From: graelo Date: Mon, 7 Nov 2022 00:05:46 +0100 Subject: [PATCH] chore: obey clippy --- src/textbuf/model.rs | 9 +++++---- src/tmux.rs | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/textbuf/model.rs b/src/textbuf/model.rs index 9cf1c51..b4e64a4 100644 --- a/src/textbuf/model.rs +++ b/src/textbuf/model.rs @@ -27,7 +27,7 @@ impl<'a> Model<'a> { unique_hint: bool, ) -> Model<'a> { let mut raw_spans = - find_raw_spans(&lines, named_patterns, custom_patterns, use_all_patterns); + find_raw_spans(lines, named_patterns, custom_patterns, use_all_patterns); if reverse { raw_spans.reverse(); @@ -113,9 +113,10 @@ fn find_raw_spans<'a>( // the start and end byte indices with respect to the chunk. let chunk_matches = all_regexes .iter() - .filter_map(|(&ref pat_name, reg)| match reg.find_iter(chunk).next() { - Some(reg_match) => Some((pat_name, reg, reg_match)), - None => None, + .filter_map(|(&ref pat_name, reg)| { + reg.find_iter(chunk) + .next() + .map(|reg_match| (pat_name, reg, reg_match)) }) .collect::>(); diff --git a/src/tmux.rs b/src/tmux.rs index b528028..cad5450 100644 --- a/src/tmux.rs +++ b/src/tmux.rs @@ -14,7 +14,7 @@ use crate::{Error, Result}; /// Represents a simplified Tmux Pane, only holding the properties needed in /// this crate. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct Pane { /// Pane identifier, e.g. `%37`. pub id: PaneId, @@ -128,7 +128,7 @@ impl Pane { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct PaneId(String); impl FromStr for PaneId { @@ -173,7 +173,7 @@ pub fn available_panes() -> Result> { let result: Result> = output .trim_end() // trim last '\n' as it would create an empty line .split('\n') - .map(|line| Pane::from_str(line)) + .map(Pane::from_str) // .map(|line| Pane::from_str(line)) .collect(); result