From 6108416e9b5c848a1082cf0217884a4303d2c387 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Sun, 25 Aug 2024 06:31:36 -0400 Subject: [PATCH] `clippy`: `edit` apply some pedantic lints warning: consider adding a `;` to the last statement for consistent formatting --> src/cmd/edit.rs:73:9 | 73 | column_index = Some(headers.len() - 1) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `column_index = Some(headers.len() - 1);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned = note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]` warning: boolean to int conversion using if --> src/cmd/edit.rs:89:34 | 89 | let mut current_row: usize = if no_headers { 1 } else { 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `usize::from(no_headers)` | = note: `no_headers as usize` or `no_headers.into()` can also be valid options = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if = note: `-W clippy::bool-to-int-with-if` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::bool_to_int_with_if)]` --- src/cmd/edit.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/edit.rs b/src/cmd/edit.rs index 42e440c29..e0016d133 100644 --- a/src/cmd/edit.rs +++ b/src/cmd/edit.rs @@ -70,7 +70,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { let headers = rdr.headers()?; let mut column_index: Option = None; if column == "_" { - column_index = Some(headers.len() - 1) + column_index = Some(headers.len() - 1); } else if let Ok(c) = column.parse::() { column_index = Some(c); } else { @@ -86,6 +86,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { } let mut record = csv::ByteRecord::new(); + #[allow(clippy::bool_to_int_with_if)] let mut current_row: usize = if no_headers { 1 } else { 0 }; while rdr.read_byte_record(&mut record)? { if row + 1 == current_row {