mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
clippy fixes
This commit is contained in:
parent
fe96537a74
commit
04308e966b
4 changed files with 20 additions and 6 deletions
|
|
@ -31,7 +31,7 @@ impl LogFile {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a str> + Send + 'a {
|
||||
pub fn iter(&self) -> impl Iterator<Item = &str> + Send + '_ {
|
||||
self.content.lines()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ fn main() -> MainResult {
|
|||
|
||||
let mut counts: HashMap<MatchResult, Vec<usize>> = HashMap::new();
|
||||
let first = lines.next().unwrap();
|
||||
let first_parsed: LogLine = match serde_json::from_str(&first) {
|
||||
let first_parsed: LogLine = match serde_json::from_str(first) {
|
||||
Ok(first_parsed) => first_parsed,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to parse the first line in the log: {:#}", e);
|
||||
|
|
@ -65,7 +65,7 @@ fn main() -> MainResult {
|
|||
.enumerate()
|
||||
.par_bridge()
|
||||
.flat_map(|(index, line)| {
|
||||
let mut parsed = serde_json::from_str::<LogLine>(&line).ok()?;
|
||||
let mut parsed = serde_json::from_str::<LogLine>(line).ok()?;
|
||||
parsed.index = index;
|
||||
Some(parsed)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use itertools::Either;
|
|||
use logsmash_data::{LogLevel, LoggingStatement, StatementList};
|
||||
use rayon::prelude::*;
|
||||
use regex::Regex;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::iter::once;
|
||||
|
||||
pub struct LogMatch {
|
||||
|
|
@ -91,7 +92,7 @@ impl Matcher {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, Hash)]
|
||||
#[derive(Debug, Clone, Eq)]
|
||||
pub enum MatchResult {
|
||||
Single(usize),
|
||||
List(Vec<usize>),
|
||||
|
|
@ -113,6 +114,19 @@ impl PartialEq for MatchResult {
|
|||
}
|
||||
}
|
||||
|
||||
impl Hash for MatchResult {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
match self {
|
||||
MatchResult::Single(i) => i.hash(state),
|
||||
MatchResult::List(list) => {
|
||||
let mut list = list.clone();
|
||||
list.sort();
|
||||
list.hash(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MatchResult {
|
||||
pub fn len(&self) -> usize {
|
||||
match self {
|
||||
|
|
|
|||
|
|
@ -180,12 +180,12 @@ impl<'a> UiState<'a> {
|
|||
|
||||
let line = &app.lines[state.lines[selected]];
|
||||
let raw = app.get_line(line.index).unwrap_or_default();
|
||||
copy_osc(&raw);
|
||||
copy_osc(raw);
|
||||
UiState::Logs(state)
|
||||
}
|
||||
(UiState::Log(state), UiEvent::Copy) => {
|
||||
let raw = app.get_line(state.log.index).unwrap_or_default();
|
||||
copy_osc(&raw);
|
||||
copy_osc(raw);
|
||||
UiState::Log(state)
|
||||
}
|
||||
(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue