Skip to content

Commit 21e42c6

Browse files
authored
Merge pull request #278 from fox0/clippy--len_zero
Fix clippy::len_zero
2 parents 28ef80b + 7484726 commit 21e42c6

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

display/echo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
8080
args.remove(0);
8181

8282
let skip_nl = {
83-
if args.len() > 0 && (args[0] == "-n") {
83+
if !args.is_empty() && (args[0] == "-n") {
8484
args.remove(0);
8585
true
8686
} else {

file/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl Type {
287287
};
288288

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

sys/who.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn show_utmpx_summary() {
171171
let mut count = 0;
172172
let entries = plib::utmpx::load();
173173
for entry in &entries {
174-
if entry.user.len() > 0 {
174+
if !entry.user.is_empty() {
175175
println!("{}", entry.user);
176176
count += 1;
177177
}

text/diff_util/file_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<'a> FileDiff<'a> {
320320
let ln2s = i64::clamp(cr.2 - context as i64, 1, f2_max as i64);
321321
let ln2e = i64::clamp(cr.3 + context as i64, 1, f2_max as i64);
322322

323-
if context_ranges.len() > 0 {
323+
if !context_ranges.is_empty() {
324324
// Overlap check
325325
if let Some((_, ln1_end, _, ln2_end)) = context_ranges.last_mut() {
326326
if *ln1_end >= ln1s as usize || *ln2_end >= ln2s as usize {

text/wc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn build_display_str(args: &Args, count: &CountInfo, filename: &OsStr) -> String
8989
output.push_str(&numstr);
9090
}
9191
if args.words {
92-
if output.len() > 0 {
92+
if !output.is_empty() {
9393
output.push(' ');
9494
}
9595
let numstr = match only_words {
@@ -99,7 +99,7 @@ fn build_display_str(args: &Args, count: &CountInfo, filename: &OsStr) -> String
9999
output.push_str(&numstr);
100100
}
101101
if args.bytes || args.chars {
102-
if output.len() > 0 {
102+
if !output.is_empty() {
103103
output.push(' ');
104104
}
105105
let numstr = match only_bytechars {

0 commit comments

Comments
 (0)