From 168e87682f1a99cb267bae1eea9d2ee6bcfc3276 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 29 Apr 2022 15:33:45 -0700 Subject: [PATCH] Resolve clippy::len_zero error: length comparison to one --> src/shims/posix/thread.rs:102:12 | 102 | if args.len() < 1 { | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `args.is_empty()` | = note: `-D clippy::len-zero` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero --- src/lib.rs | 1 - src/shims/posix/thread.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0063753418b..9fbc3f8a33b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,6 @@ clippy::field_reassign_with_default, clippy::from_over_into, clippy::if_same_then_else, - clippy::len_zero, clippy::manual_map, clippy::mem_replace_with_default, clippy::needless_borrow, diff --git a/src/shims/posix/thread.rs b/src/shims/posix/thread.rs index 7840a1e1e97..0b8684d39eb 100644 --- a/src/shims/posix/thread.rs +++ b/src/shims/posix/thread.rs @@ -99,7 +99,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let this = self.eval_context_mut(); this.assert_target_os("linux", "prctl"); - if args.len() < 1 { + if args.is_empty() { throw_ub_format!( "incorrect number of arguments for `prctl`: got {}, expected at least 1", args.len()