summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/symmetric.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/crypto/symmetric.rs')
-rw-r--r--openpgp/src/crypto/symmetric.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/openpgp/src/crypto/symmetric.rs b/openpgp/src/crypto/symmetric.rs
index dba529ef..45e9cbd9 100644
--- a/openpgp/src/crypto/symmetric.rs
+++ b/openpgp/src/crypto/symmetric.rs
@@ -107,7 +107,7 @@ impl<R: io::Read> io::Read for Decryptor<R> {
let mut pos = 0;
// 1. Copy any buffered data.
- if self.buffer.len() > 0 {
+ if !self.buffer.is_empty() {
let to_copy = cmp::min(self.buffer.len(), plaintext.len());
&plaintext[..to_copy].copy_from_slice(&self.buffer[..to_copy]);
crate::vec_drain_prefix(&mut self.buffer, to_copy);
@@ -334,7 +334,7 @@ impl<W: io::Write> Encryptor<W> {
/// Finish encryption and write last partial block.
pub fn finish(&mut self) -> Result<W> {
if let Some(mut inner) = self.inner.take() {
- if self.buffer.len() > 0 {
+ if !self.buffer.is_empty() {
unsafe { self.scratch.set_len(self.buffer.len()) }
self.cipher.encrypt(&mut self.scratch, &self.buffer)?;
crate::vec_truncate(&mut self.buffer, 0);
@@ -369,7 +369,7 @@ impl<W: io::Write> io::Write for Encryptor<W> {
let amount = buf.len();
// First, fill the buffer if there is something in it.
- if self.buffer.len() > 0 {
+ if !self.buffer.is_empty() {
let n = cmp::min(buf.len(), self.block_size - self.buffer.len());
self.buffer.extend_from_slice(&buf[..n]);
assert!(self.buffer.len() <= self.block_size);