Skip to content

Fix clippy::len_zero #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion display/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
args.remove(0);

let skip_nl = {
if args.len() > 0 && (args[0] == "-n") {
if !args.is_empty() && (args[0] == "-n") {
args.remove(0);
true
} else {
Expand Down
2 changes: 1 addition & 1 deletion file/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl Type {
};

// the input string should be empty after all the steps being followed
if input.len() != 0 {
if !input.is_empty() {
return Err(RawMagicLineParseError::InvalidTypeFormat);
}

Expand Down
2 changes: 1 addition & 1 deletion sys/who.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn show_utmpx_summary() {
let mut count = 0;
let entries = plib::utmpx::load();
for entry in &entries {
if entry.user.len() > 0 {
if !entry.user.is_empty() {
println!("{}", entry.user);
count += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion text/diff_util/file_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl<'a> FileDiff<'a> {
let ln2s = i64::clamp(cr.2 - context as i64, 1, f2_max as i64);
let ln2e = i64::clamp(cr.3 + context as i64, 1, f2_max as i64);

if context_ranges.len() > 0 {
if !context_ranges.is_empty() {
// Overlap check
if let Some((_, ln1_end, _, ln2_end)) = context_ranges.last_mut() {
if *ln1_end >= ln1s as usize || *ln2_end >= ln2s as usize {
Expand Down
4 changes: 2 additions & 2 deletions text/wc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn build_display_str(args: &Args, count: &CountInfo, filename: &OsStr) -> String
output.push_str(&numstr);
}
if args.words {
if output.len() > 0 {
if !output.is_empty() {
output.push(' ');
}
let numstr = match only_words {
Expand All @@ -99,7 +99,7 @@ fn build_display_str(args: &Args, count: &CountInfo, filename: &OsStr) -> String
output.push_str(&numstr);
}
if args.bytes || args.chars {
if output.len() > 0 {
if !output.is_empty() {
output.push(' ');
}
let numstr = match only_bytechars {
Expand Down