From 5a42eb989bf7ec3391c9c3030b63d518e9ba305c Mon Sep 17 00:00:00 2001 From: William G Underwood <42812654+WGUNDERWOOD@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:54:51 +0100 Subject: [PATCH] Clippy --- src/format.rs | 6 ++++-- src/indent.rs | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/format.rs b/src/format.rs index 3218af1..10a0c5e 100644 --- a/src/format.rs +++ b/src/format.rs @@ -74,8 +74,10 @@ pub fn format_file( &pattern, ); - let indent_length = usize::try_from(indent.visual * args.tab as i8) - .expect("Visual indent is non-negative."); + #[allow(clippy::cast_possible_wrap)] + let indent_length = + usize::try_from(indent.visual * args.tab as i8) + .expect("Visual indent is non-negative."); // Wrap the line before applying the indent, and loop back // if the line needed wrapping. diff --git a/src/indent.rs b/src/indent.rs index d184d31..161bb83 100644 --- a/src/indent.rs +++ b/src/indent.rs @@ -184,7 +184,9 @@ pub fn apply_indent( // Otherwise, allocate enough memory to fit line with the added // indentation and insert the appropriate string slices } else { - let n_indent_chars = usize::try_from(indent.visual * args.tab as i8).unwrap(); + #[allow(clippy::cast_possible_wrap)] + let n_indent_chars = + usize::try_from(indent.visual * args.tab as i8).unwrap(); let mut new_line = String::with_capacity(trimmed_line.len() + n_indent_chars); for idx in 0..n_indent_chars {