clippy fixes

This commit is contained in:
Robin Appelman 2025-03-26 18:36:44 +01:00
commit 29e57dd6e3
4 changed files with 6 additions and 10 deletions

View file

@ -132,10 +132,7 @@ fn group_lines<I: Iterator<Item = usize>>(all_lines: &[LogLine], indices: I) ->
map.entry(line.identity()).or_default().push(i); map.entry(line.identity()).or_default().push(i);
} }
let mut list: Vec<_> = map let mut list: Vec<_> = map.into_values().map(GroupedLines::new).collect();
.into_values()
.map(|lines| GroupedLines::new(lines))
.collect();
list.sort_by_key(|list| list.len()); list.sort_by_key(|list| list.len());
list.reverse(); list.reverse();
list list

View file

@ -265,6 +265,7 @@ impl<'a> SingleMatchState<'a> {
#[test] #[test]
fn test_matcher() { fn test_matcher() {
use crate::logfile::logline::Exception; use crate::logfile::logline::Exception;
use crate::logfile::LogIndex;
use std::str::FromStr; use std::str::FromStr;
use time::OffsetDateTime; use time::OffsetDateTime;
use tinystr::TinyAsciiStr; use tinystr::TinyAsciiStr;
@ -333,7 +334,7 @@ fn test_matcher() {
message: "Not allowed to rename a shared album".into(), message: "Not allowed to rename a shared album".into(),
exception: None, exception: None,
time: OffsetDateTime::now_utc(), time: OffsetDateTime::now_utc(),
index: 0, index: LogIndex::from(0),
method: TinyAsciiStr::from_str("GET").unwrap(), method: TinyAsciiStr::from_str("GET").unwrap(),
remote: TinyAsciiStr::from_str("1.2.3.4").unwrap(), remote: TinyAsciiStr::from_str("1.2.3.4").unwrap(),
user: TinyAsciiStr::from_str("user").unwrap(), user: TinyAsciiStr::from_str("user").unwrap(),
@ -406,7 +407,7 @@ fn test_matcher() {
message: "".into(), message: "".into(),
exception: "Bar\\FooException".into(), exception: "Bar\\FooException".into(),
file: "short".into(), file: "short".into(),
line: 68, line: LineNumber::from(68),
}), }),
..default_log.clone() ..default_log.clone()
} }

View file

@ -137,7 +137,7 @@ fn ui(frame: &mut Frame, app: &App, state: &mut UiState) {
&result.grouped[selected - 1] &result.grouped[selected - 1]
}; };
frame.render_widget(UiHistogram::new(&selected_group.histogram(app)), layout[0]); frame.render_widget(UiHistogram::new(selected_group.histogram(app)), layout[0]);
frame.render_stateful_widget( frame.render_stateful_widget(
grouped_lines(app, result, filter), grouped_lines(app, result, filter),
layout[1], layout[1],

View file

@ -1,6 +1,4 @@
use crate::app::{App, Filter, GroupedLines, LogMatch}; use crate::app::{App, Filter, GroupedLines, LogMatch};
use crate::ui::grouped_logs::GroupedLogs;
use crate::ui::state::GroupedLogGrouping;
use crate::ui::style::TABLE_HEADER_STYLE; use crate::ui::style::TABLE_HEADER_STYLE;
use crate::ui::table::{ScrollbarTable, ScrollbarTableState}; use crate::ui::table::{ScrollbarTable, ScrollbarTableState};
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
@ -18,7 +16,7 @@ pub fn grouped_lines<'a>(
SingleMatchTable { SingleMatchTable {
app, app,
log_match, log_match,
filter filter,
} }
} }