nixpkgs 25.11, clippy fixes

This commit is contained in:
Robin Appelman 2025-12-01 21:15:50 +01:00
commit 564d719bb9
11 changed files with 39 additions and 36 deletions

View file

@ -23,7 +23,7 @@ pub trait Archive {
}
pub trait ArchiveEntry {
fn name(&self) -> Cow<str>;
fn name<'a>(&'a self) -> Cow<'a, str>;
fn extract(self) -> Result<Vec<u8>, ReadError>;
}

View file

@ -18,7 +18,7 @@ pub struct RarEntry {
}
impl ArchiveEntry for RarEntry {
fn name(&self) -> Cow<str> {
fn name<'a>(&'a self) -> Cow<'a, str> {
self.name.as_str().into()
}

View file

@ -22,7 +22,7 @@ pub struct SevenZipEntry<'a, R: Read + Seek> {
}
impl<R: Read + Seek> ArchiveEntry for SevenZipEntry<'_, R> {
fn name(&self) -> Cow<str> {
fn name<'a>(&'a self) -> Cow<'a, str> {
self.name.as_str().into()
}

View file

@ -31,7 +31,7 @@ impl TarEntry {
}
impl ArchiveEntry for TarEntry {
fn name(&self) -> Cow<str> {
fn name<'a>(&'a self) -> Cow<'a, str> {
self.name.as_str().into()
}

View file

@ -27,7 +27,7 @@ impl<R: Read + Seek> ZipArchive<R> {
}
impl<R: Read + Seek> ArchiveEntry for ZipEntry<'_, R> {
fn name(&self) -> Cow<str> {
fn name<'a>(&'a self) -> Cow<'a, str> {
self.path.as_str().into()
}

View file

@ -214,11 +214,11 @@ impl<'a> LogLine<'a> {
})
}
pub fn cleaned_message(&self) -> Cow<str> {
pub fn cleaned_message<'this>(&'this self) -> Cow<'this, str> {
clean_log_message(&self.message)
}
pub fn cleaned_message_single_line(&self) -> Cow<str> {
pub fn cleaned_message_single_line<'this>(&'this self) -> Cow<'this, str> {
if self.message.contains('\t') || self.message.contains('\n') {
Cow::Owned(self.message.replace(['\t', '\n'], " "))
} else {
@ -227,7 +227,7 @@ impl<'a> LogLine<'a> {
}
}
fn clean_log_message(message: &str) -> Cow<str> {
fn clean_log_message<'a>(message: &'a str) -> Cow<'a, str> {
if message.contains('\t') {
Cow::Owned(message.replace('\t', " "))
} else {
@ -308,7 +308,7 @@ impl FullLogLine {
.filter(|(key, _)| *key != "app")
}
pub fn cleaned_message(&self) -> Cow<str> {
pub fn cleaned_message<'a>(&'a self) -> Cow<'a, str> {
clean_log_message(&self.message)
}
}

View file

@ -217,7 +217,7 @@ fn copy_osc(text: &str) {
print!("\x1B]52;c;{}\x07", BASE64_STANDARD.encode(text));
}
fn parse_line(mut line: &str) -> Result<LogLine, serde_json::Error> {
fn parse_line<'a>(mut line: &'a str) -> Result<LogLine<'a>, serde_json::Error> {
if let Some(pos) = line.find('{') {
line = &line[pos..];
}

View file

@ -6,7 +6,7 @@ use ratatui::widgets::{Block, BorderType, Borders, Cell, Paragraph, Row, Wrap};
use std::fmt::Write;
use std::iter::once;
pub fn single_log(line: &FullLogLine) -> SingleLog {
pub fn single_log<'a>(line: &'a FullLogLine) -> SingleLog<'a> {
SingleLog::new(line)
}
@ -129,7 +129,10 @@ impl StatefulWidget for SingleLog<'_> {
}
}
pub fn render_exception(exception: &FullException, path_prefix_length: usize) -> ScrollbarTable {
pub fn render_exception<'a>(
exception: &'a FullException,
path_prefix_length: usize,
) -> ScrollbarTable<'a> {
let header = [
Text::from("File"),
Text::from("Line").alignment(Alignment::Right),
@ -152,10 +155,10 @@ pub fn render_exception(exception: &FullException, path_prefix_length: usize) ->
ScrollbarTable::new(rows, widths).header(header)
}
fn exception_trace(
exception: &FullException,
fn exception_trace<'a>(
exception: &'a FullException,
path_prefix_length: usize,
) -> impl Iterator<Item = Row> + '_ {
) -> impl Iterator<Item = Row<'a>> + 'a {
let exception_row = Row::new([
Text::from(
exception
@ -175,7 +178,7 @@ fn exception_trace(
once(exception_row).chain(trace_rows)
}
fn trace_line(trace: &Trace, path_prefix_length: usize) -> Row {
fn trace_line<'a>(trace: &'a Trace, path_prefix_length: usize) -> Row<'a> {
Row::new([
Text::from(
trace
@ -190,7 +193,7 @@ fn trace_line(trace: &Trace, path_prefix_length: usize) -> Row {
])
}
pub fn render_data(log: &FullLogLine) -> (ScrollbarTable, u16) {
pub fn render_data<'a>(log: &'a FullLogLine) -> (ScrollbarTable<'a>, u16) {
let header = [Text::from("Key"), Text::from("Value")]
.into_iter()
.map(Cell::from)

View file

@ -713,7 +713,7 @@ impl<'a> UiState<'a> {
}
}
pub fn footer_params(&self) -> FooterParams {
pub fn footer_params<'this>(&'this self) -> FooterParams<'this> {
match self.mode() {
Mode::Normal => FooterParams::Normal { page: self.page() },
Mode::FilterInput => FooterParams::FilterInput {