diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-07 20:23:44 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-09 13:13:59 +0200 |
commit | 19169b76117db8b1d81f1aafa64a5440d042803d (patch) | |
tree | bdd07c05920f6217bd1512e6dc56c1d8fb1da6bf /openpgp/src/parse | |
parent | 694680ae3b2192c102f1b9a4d342677545cac629 (diff) |
Lint: Use is_empty().
- https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
- https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty
Diffstat (limited to 'openpgp/src/parse')
-rw-r--r-- | openpgp/src/parse/hashed_reader.rs | 4 | ||||
-rw-r--r-- | openpgp/src/parse/stream.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/openpgp/src/parse/hashed_reader.rs b/openpgp/src/parse/hashed_reader.rs index 03de2916..be074570 100644 --- a/openpgp/src/parse/hashed_reader.rs +++ b/openpgp/src/parse/hashed_reader.rs @@ -123,7 +123,7 @@ impl Cookie { } } - if data.len() == 0 { + if data.is_empty() { return; } @@ -178,7 +178,7 @@ impl Cookie { data = &data[1..]; } - if data.len() == 0 { + if data.is_empty() { return; } diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 88313604..5170eb8f 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -2868,7 +2868,7 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { /// Like `io::Read::read()`, but returns our `Result`. fn read_helper(&mut self, buf: &mut [u8]) -> Result<usize> { - if buf.len() == 0 { + if buf.is_empty() { return Ok(0); } @@ -3456,7 +3456,7 @@ mod test { // Check that we only got a truncated message. assert!(v.message_processed()); - assert!(message.len() > 0); + assert!(!message.is_empty()); assert!(message.len() <= 1 * 1024 * 1024); assert!(message.iter().all(|&b| b == 42)); assert!(v.helper_ref().good == 1); @@ -3507,7 +3507,7 @@ mod test { // Check that we only got a truncated message. assert!(v.message_processed()); - assert!(message.len() > 0); + assert!(!message.is_empty()); assert!(message.len() <= 1 * 1024 * 1024); assert!(message.iter().all(|&b| b == 42)); assert!(v.helper_ref().good == 1); |