chore: obey clippy

This commit is contained in:
graelo 2022-11-07 00:05:46 +01:00
parent 10013a6c6d
commit 26e7d9767e
2 changed files with 8 additions and 7 deletions

View file

@ -27,7 +27,7 @@ impl<'a> Model<'a> {
unique_hint: bool, unique_hint: bool,
) -> Model<'a> { ) -> Model<'a> {
let mut raw_spans = 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 { if reverse {
raw_spans.reverse(); raw_spans.reverse();
@ -113,9 +113,10 @@ fn find_raw_spans<'a>(
// the start and end byte indices with respect to the chunk. // the start and end byte indices with respect to the chunk.
let chunk_matches = all_regexes let chunk_matches = all_regexes
.iter() .iter()
.filter_map(|(&ref pat_name, reg)| match reg.find_iter(chunk).next() { .filter_map(|(&ref pat_name, reg)| {
Some(reg_match) => Some((pat_name, reg, reg_match)), reg.find_iter(chunk)
None => None, .next()
.map(|reg_match| (pat_name, reg, reg_match))
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();

View file

@ -14,7 +14,7 @@ use crate::{Error, Result};
/// Represents a simplified Tmux Pane, only holding the properties needed in /// Represents a simplified Tmux Pane, only holding the properties needed in
/// this crate. /// this crate.
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct Pane { pub struct Pane {
/// Pane identifier, e.g. `%37`. /// Pane identifier, e.g. `%37`.
pub id: PaneId, pub id: PaneId,
@ -128,7 +128,7 @@ impl Pane {
} }
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct PaneId(String); pub struct PaneId(String);
impl FromStr for PaneId { impl FromStr for PaneId {
@ -173,7 +173,7 @@ pub fn available_panes() -> Result<Vec<Pane>> {
let result: Result<Vec<Pane>> = output let result: Result<Vec<Pane>> = output
.trim_end() // trim last '\n' as it would create an empty line .trim_end() // trim last '\n' as it would create an empty line
.split('\n') .split('\n')
.map(|line| Pane::from_str(line)) .map(Pane::from_str) // .map(|line| Pane::from_str(line))
.collect(); .collect();
result result