chore: fix linting warnings (#230)

This commit is contained in:
Alex Pasmantier 2025-01-06 19:23:28 +01:00 committed by GitHub
parent da2396e19a
commit d20784891f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 106 additions and 94 deletions

View File

@ -8,6 +8,7 @@ use television_channels::entry::merge_ranges;
use television_channels::entry::{Entry, PreviewType};
use television_screen::colors::ResultsColorscheme;
use television_screen::results::build_results_list;
pub fn results_list_benchmark(c: &mut Criterion) {
let mut icon_color_cache = std::collections::HashMap::default();
// FIXME: there's probably a way to have this as a benchmark asset
@ -17,7 +18,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/LICENSE".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -34,7 +35,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/README.md".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -51,7 +52,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/re.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -68,7 +69,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/io.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -85,7 +86,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/gc.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -102,7 +103,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/uu.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -119,7 +120,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/nt.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -136,7 +137,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/dis.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -153,7 +154,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/imp.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -170,7 +171,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/bdb.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -187,7 +188,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/abc.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -204,7 +205,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/cgi.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -221,7 +222,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/bz2.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -238,7 +239,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/grp.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -255,7 +256,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/ast.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -272,7 +273,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/csv.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -289,7 +290,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/pdb.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -306,7 +307,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/pwd.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -323,7 +324,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/ssl.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -340,7 +341,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/tty.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -357,7 +358,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/nis.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -374,7 +375,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/pty.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -391,7 +392,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/cmd.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -408,7 +409,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/tests/utils.py".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -425,7 +426,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/pyproject.toml".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -442,7 +443,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/MAINTAINERS.md".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -459,7 +460,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/enum.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -476,7 +477,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/hmac.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -493,7 +494,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/uuid.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -510,7 +511,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/glob.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -527,7 +528,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/_ast.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -544,7 +545,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/_csv.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -561,7 +562,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/code.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -578,7 +579,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/spwd.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -595,7 +596,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
Entry {
name: "typeshed/stdlib/_msi.pyi".to_string(),
value: None,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -619,7 +620,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
}),
line_number: None,
preview_type: PreviewType::Files,
name_match_ranges: Some(merge_ranges(&vec![
name_match_ranges: Some(merge_ranges(&[
(0, 1),
(1, 2),
(2, 3),
@ -655,7 +656,7 @@ pub fn results_list_benchmark(c: &mut Criterion) {
&mut icon_color_cache,
&colorscheme,
);
})
});
});
}

View File

@ -15,6 +15,7 @@ pub struct CableChannelPrototype {
pub const DEFAULT_DELIMITER: &str = " ";
#[allow(clippy::unnecessary_wraps)]
fn default_delimiter() -> Option<String> {
Some(DEFAULT_DELIMITER.to_string())
}

View File

@ -89,18 +89,17 @@ impl OnAir for Channel {
.with_icon(self.file_icon);
if should_add_name_indices {
entry = entry.with_name_match_ranges(
name_indices.into_iter().map(|i| (i, i + 1)).collect(),
);
let name_indices: Vec<(u32, u32)> =
name_indices.into_iter().map(|i| (i, i + 1)).collect();
entry = entry.with_name_match_ranges(&name_indices);
}
if should_add_value_indices {
entry = entry.with_value_match_ranges(
value_indices
.into_iter()
.map(|i| (i, i + 1))
.collect(),
);
let value_indices: Vec<(u32, u32)> = value_indices
.into_iter()
.map(|i| (i, i + 1))
.collect();
entry = entry.with_value_match_ranges(&value_indices);
}
entry

View File

@ -141,7 +141,7 @@ impl OnAir for Channel {
PreviewKind::None => PreviewType::None,
},
)
.with_name_match_ranges(item.match_indices)
.with_name_match_ranges(&item.match_indices)
})
.collect()
}

View File

@ -84,7 +84,7 @@ impl OnAir for Channel {
" ",
)),
)
.with_name_match_ranges(item.match_indices)
.with_name_match_ranges(&item.match_indices)
.with_icon(FileIcon::from(&path))
})
.collect()

View File

@ -69,18 +69,17 @@ impl OnAir for Channel {
.with_icon(self.file_icon);
if should_add_name_indices {
entry = entry.with_name_match_ranges(
name_indices.into_iter().map(|i| (i, i + 1)).collect(),
);
let name_indices: Vec<(u32, u32)> =
name_indices.into_iter().map(|i| (i, i + 1)).collect();
entry = entry.with_name_match_ranges(&name_indices);
}
if should_add_value_indices {
entry = entry.with_value_match_ranges(
value_indices
.into_iter()
.map(|i| (i, i + 1))
.collect(),
);
let value_indices: Vec<(u32, u32)> = value_indices
.into_iter()
.map(|i| (i, i + 1))
.collect();
entry = entry.with_value_match_ranges(&value_indices);
}
entry

View File

@ -92,7 +92,7 @@ impl OnAir for Channel {
.map(|item| {
let path = item.matched_string;
Entry::new(path.clone(), PreviewType::Files)
.with_name_match_ranges(item.match_indices)
.with_name_match_ranges(&item.match_indices)
.with_icon(FileIcon::from(&path))
})
.collect()

View File

@ -64,7 +64,7 @@ impl OnAir for Channel {
path.clone(),
PreviewType::Command(PREVIEW_COMMAND.clone()),
)
.with_name_match_ranges(item.match_indices)
.with_name_match_ranges(&item.match_indices)
.with_icon(self.icon)
})
.collect()

View File

@ -131,7 +131,7 @@ impl OnAir for RemoteControl {
.map(|item| {
let path = item.matched_string;
Entry::new(path, PreviewType::Basic)
.with_name_match_ranges(item.match_indices)
.with_name_match_ranges(&item.match_indices)
.with_icon(match item.inner {
RCButton::Channel(_) => TV_ICON,
RCButton::CableChannel(_) => CABLE_ICON,

View File

@ -79,7 +79,7 @@ impl OnAir for Channel {
// NOTE: we're passing `PreviewType::Basic` here just as a placeholder
// to avoid storing the preview command multiple times for each item.
Entry::new(item.matched_string, PreviewType::Basic)
.with_name_match_ranges(item.match_indices)
.with_name_match_ranges(&item.match_indices)
})
.collect()
}

View File

@ -179,7 +179,7 @@ impl OnAir for Channel {
item.inner.path.to_string_lossy().to_string();
Entry::new(display_path, PreviewType::Files)
.with_value(line)
.with_value_match_ranges(item.match_indices)
.with_value_match_ranges(&item.match_indices)
.with_icon(FileIcon::from(item.inner.path.as_path()))
.with_line_number(item.inner.line_number)
})

View File

@ -56,8 +56,8 @@ impl Entry {
///
/// let entry = Entry::new("name".to_string(), PreviewType::EnvVar)
/// .with_value("value".to_string())
/// .with_name_match_ranges(vec![(0, 1)])
/// .with_value_match_ranges(vec![(0, 1)])
/// .with_name_match_ranges(&vec![(0, 1)])
/// .with_value_match_ranges(&vec![(0, 1)])
/// .with_icon(FileIcon::default())
/// .with_line_number(0);
/// ```
@ -88,17 +88,17 @@ impl Entry {
pub fn with_name_match_ranges(
mut self,
name_match_ranges: Vec<(u32, u32)>,
name_match_ranges: &[(u32, u32)],
) -> Self {
self.name_match_ranges = Some(merge_ranges(&name_match_ranges));
self.name_match_ranges = Some(merge_ranges(name_match_ranges));
self
}
pub fn with_value_match_ranges(
mut self,
value_match_ranges: Vec<(u32, u32)>,
value_match_ranges: &[(u32, u32)],
) -> Self {
self.value_match_ranges = Some(merge_ranges(&value_match_ranges));
self.value_match_ranges = Some(merge_ranges(value_match_ranges));
self
}
@ -154,7 +154,7 @@ impl PreviewCommand {
impl Display for PreviewCommand {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
write!(f, "{self:?}")
}
}

View File

@ -10,7 +10,7 @@ pub mod parser;
pub use error::Error;
use tui::text::Text;
/// IntoText will convert any type that has a AsRef<[u8]> to a Text.
/// `IntoText` will convert any type that has a `AsRef<[u8]>` to a Text.
pub trait IntoText {
/// Convert the type to a Text.
#[allow(clippy::wrong_self_convention)]

View File

@ -1,10 +1,10 @@
use tui::style::Color;
/// This enum stores most types of ansi escape sequences
/// This enum stores most types of ansi escape sequences
///
/// You can turn an escape sequence to this enum variant using
/// AnsiCode::from(code: u8)
/// This doesn't support all of them but does support most of them.
/// `AnsiCode::from(code: u8)`
/// This doesn't support all of them but does support most of them.
#[derive(Debug, PartialEq, Clone)]
#[non_exhaustive]
@ -124,6 +124,7 @@ impl From<u8> for AnsiCode {
94 => AnsiCode::ForegroundColor(Color::LightBlue),
95 => AnsiCode::ForegroundColor(Color::LightMagenta),
96 => AnsiCode::ForegroundColor(Color::LightCyan),
#[allow(clippy::match_same_arms)]
97 => AnsiCode::ForegroundColor(Color::White),
100 => AnsiCode::BackgroundColor(Color::DarkGray),
101 => AnsiCode::BackgroundColor(Color::LightRed),

View File

@ -48,32 +48,32 @@ impl From<AnsiStates> for tui::style::Style {
.remove_modifier(Modifier::DIM);
}
AnsiCode::Italic => {
style = style.add_modifier(Modifier::ITALIC)
style = style.add_modifier(Modifier::ITALIC);
}
AnsiCode::Underline => {
style = style.add_modifier(Modifier::UNDERLINED)
style = style.add_modifier(Modifier::UNDERLINED);
}
AnsiCode::SlowBlink => {
style = style.add_modifier(Modifier::SLOW_BLINK)
style = style.add_modifier(Modifier::SLOW_BLINK);
}
AnsiCode::RapidBlink => {
style = style.add_modifier(Modifier::RAPID_BLINK)
style = style.add_modifier(Modifier::RAPID_BLINK);
}
AnsiCode::Reverse => {
style = style.add_modifier(Modifier::REVERSED)
style = style.add_modifier(Modifier::REVERSED);
}
AnsiCode::Conceal => {
style = style.add_modifier(Modifier::HIDDEN)
style = style.add_modifier(Modifier::HIDDEN);
}
AnsiCode::CrossedOut => {
style = style.add_modifier(Modifier::CROSSED_OUT)
style = style.add_modifier(Modifier::CROSSED_OUT);
}
AnsiCode::DefaultForegroundColor => {
style = style.fg(Color::Reset)
style = style.fg(Color::Reset);
}
AnsiCode::SetForegroundColor => {
if let Some(color) = item.color {
style = style.fg(color)
style = style.fg(color);
}
}
AnsiCode::ForegroundColor(color) => style = style.fg(color),
@ -84,13 +84,14 @@ impl From<AnsiStates> for tui::style::Style {
}
}
#[allow(clippy::unnecessary_wraps)]
pub(crate) fn text(mut s: &[u8]) -> IResult<&[u8], Text<'static>> {
let mut lines = Vec::new();
let mut last = Style::new();
while let Ok((_s, (line, style))) = line(last)(s) {
while let Ok((c, (line, style))) = line(last)(s) {
lines.push(line);
last = style;
s = _s;
s = c;
if s.is_empty() {
break;
}
@ -99,13 +100,14 @@ pub(crate) fn text(mut s: &[u8]) -> IResult<&[u8], Text<'static>> {
}
#[cfg(feature = "zero-copy")]
#[allow(clippy::unnecessary_wraps)]
pub(crate) fn text_fast(mut s: &[u8]) -> IResult<&[u8], Text<'_>> {
let mut lines = Vec::new();
let mut last = Style::new();
while let Ok((_s, (line, style))) = line_fast(last)(s) {
while let Ok((c, (line, style))) = line_fast(last)(s) {
lines.push(line);
last = style;
s = _s;
s = c;
if s.is_empty() {
break;
}

View File

@ -47,7 +47,7 @@ const PATH: &str = "PATH";
fn maybe_add_newline_after_colon(s: &str, name: &str) -> String {
if name.contains(PATH) {
return s.replace(":", "\n");
return s.replace(':', "\n");
}
s.to_string()
}

View File

@ -125,8 +125,8 @@ impl FilePreviewer {
}
#[allow(dead_code)]
fn cache_preview(&mut self, key: String, preview: Arc<Preview>) {
self.cache.lock().insert(key, &preview);
fn cache_preview(&mut self, key: String, preview: &Arc<Preview>) {
self.cache.lock().insert(key, preview);
}
}

View File

@ -55,7 +55,7 @@ pub fn draw_input_box(
Constraint::Fill(1),
// result count
Constraint::Length(
3 * ((total_count as f32).log10().ceil() as u16 + 1) + 3,
3 * (u16::try_from((total_count).ilog10()).unwrap() + 1) + 3,
),
// spinner
Constraint::Length(1),

View File

@ -27,6 +27,7 @@ use television_utils::strings::{
const FILL_CHAR_SLANTED: char = '';
const FILL_CHAR_EMPTY: char = ' ';
#[allow(clippy::needless_pass_by_value)]
pub fn build_preview_paragraph(
preview_block: Block<'_>,
inner: Rect,
@ -89,6 +90,7 @@ pub fn build_preview_paragraph(
}
}
#[allow(clippy::needless_pass_by_value)]
fn build_ansi_text_paragraph(
text: String,
preview_block: Block,
@ -110,6 +112,7 @@ fn build_ansi_text_paragraph(
.scroll((preview_scroll, 0))
}
#[allow(clippy::needless_pass_by_value)]
fn build_plain_text_paragraph(
text: Vec<String>,
preview_block: Block<'_>,
@ -151,6 +154,7 @@ fn build_plain_text_paragraph(
.scroll((preview_scroll, 0))
}
#[allow(clippy::needless_pass_by_value)]
fn build_plain_text_wrapped_paragraph(
text: String,
preview_block: Block<'_>,
@ -169,6 +173,7 @@ fn build_plain_text_wrapped_paragraph(
.wrap(Wrap { trim: true })
}
#[allow(clippy::needless_pass_by_value)]
fn build_syntect_highlighted_paragraph(
highlighted_lines: Vec<Vec<(syntect::highlighting::Style, String)>>,
preview_block: Block,

View File

@ -273,6 +273,7 @@ pub fn guess_channel_from_prompt(
Err(eyre!("No channel found for prompt: {}", prompt))
}
#[allow(clippy::unnecessary_wraps)]
fn delimiter_parser(s: &str) -> Result<String, String> {
Ok(match s {
"" => ":".to_string(),

View File

@ -16,10 +16,12 @@ pub enum Binding {
impl Display for Binding {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Binding::SingleKey(key) => write!(f, "{}", key),
Binding::SingleKey(key) => write!(f, "{key}"),
Binding::MultipleKeys(keys) => {
let keys_str: Vec<String> =
keys.iter().map(|k| k.to_string()).collect();
let keys_str: Vec<String> = keys
.iter()
.map(std::string::ToString::to_string)
.collect();
write!(f, "{}", keys_str.join(", "))
}
}

View File

@ -256,6 +256,7 @@ impl Television {
Ok(())
}
#[allow(clippy::unused_async)]
/// Update the state of the component based on a received action.
///
/// # Arguments

View File

@ -108,7 +108,7 @@ where
{
fn drop(&mut self) {
match self.exit() {
Ok(_) => debug!("Successfully exited terminal"),
Ok(()) => debug!("Successfully exited terminal"),
Err(e) => debug!("Failed to exit terminal: {:?}", e),
}
}