Skip to content

Commit

Permalink
clippy::len_zero
Browse files Browse the repository at this point in the history
warning: length comparison to zero
   --> src/cmd/sqlp.rs:505:25
    |
505 |             .filter(|s| s.trim().len() > 0)
    |                         ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!s.trim().is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
    = note: `#[warn(clippy::len_zero)]` on by default
  • Loading branch information
jqnatividad committed Dec 24, 2023
1 parent b40b808 commit d3f5f19
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion src/cmd/sqlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
sql_script
.split(';')
.map(std::string::ToString::to_string)
.filter(|s| s.trim().len() > 0)
.filter(|s| !s.trim().is_empty())
.collect()
} else {
// its not a sql script, just a single query
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
clippy::unnecessary_wraps,
// false positive
clippy::needless_doctest_main,
// performance
clippy::len_zero,
// noisy
clippy::missing_errors_doc,
clippy::must_use_candidate,
Expand Down

0 comments on commit d3f5f19

Please sign in to comment.