Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Oct 16, 2024
1 parent 0179f12 commit 5a42eb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 5a42eb9

Please sign in to comment.