From 612fd79bae2d76b49979a1b0254d8fd268f79900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 24 Jun 2022 11:25:16 +0200 Subject: [PATCH] random: Fix "nonminimal-bool" clippy warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error shown below was caught during a dependency bump in the CCv0 branch, but we better fix it here first. ``` error: this boolean expression can be simplified --> src/random.rs:85:21 | 85 | assert!(!ret.is_ok()); | ^^^^^^^^^^^^ help: try: `ret.is_err()` | = note: `-D clippy::nonminimal-bool` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool error: this boolean expression can be simplified --> src/random.rs:93:17 | 93 | assert!(!ret.is_ok()); | ^^^^^^^^^^^^ help: try: `ret.is_err()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool ``` Fixes: #4523 Signed-off-by: Fabiano FidĂȘncio --- src/agent/src/random.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agent/src/random.rs b/src/agent/src/random.rs index c2506ac246..1c83f03f0d 100644 --- a/src/agent/src/random.rs +++ b/src/agent/src/random.rs @@ -82,7 +82,7 @@ mod tests { if nix::unistd::Uid::effective().is_root() { assert!(ret.is_ok()); } else { - assert!(!ret.is_ok()); + assert!(ret.is_err()); } } @@ -90,6 +90,6 @@ mod tests { fn test_reseed_rng_zero_data() { let seed = []; let ret = reseed_rng(&seed); - assert!(!ret.is_ok()); + assert!(ret.is_err()); } }