diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-07 16:12:06 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-04-09 13:13:58 +0200 |
commit | a23a14d0471512d360364b69df51161e84c9e0d0 (patch) | |
tree | 96f9c3d1ba810656bc72788bb354d727772b4fb9 /openpgp | |
parent | 0c538f122d7a498a58f9b380b6be03a40f827c3e (diff) |
Lint: Remove redundant closures.
- https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/packet/mod.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse.rs | 2 | ||||
-rw-r--r-- | openpgp/src/parse/hashed_reader.rs | 4 | ||||
-rw-r--r-- | openpgp/src/regex/mod.rs | 2 | ||||
-rw-r--r-- | openpgp/src/serialize/stream/dash_escape.rs | 2 | ||||
-rw-r--r-- | openpgp/src/serialize/stream/trim_whitespace.rs | 2 | ||||
-rw-r--r-- | openpgp/src/types/timestamp.rs | 4 |
7 files changed, 9 insertions, 9 deletions
diff --git a/openpgp/src/packet/mod.rs b/openpgp/src/packet/mod.rs index ae92462a..52a58f56 100644 --- a/openpgp/src/packet/mod.rs +++ b/openpgp/src/packet/mod.rs @@ -646,7 +646,7 @@ impl<'a> Iterator for Iter<'a> { // Get the next child and the iterator for its children. self.child = self.children.next(); if let Some(child) = self.child { - self.grandchildren = child.descendants().map(|d| Box::new(d)); + self.grandchildren = child.descendants().map(Box::new); } // First return the child itself. Subsequent calls will diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index 30593e82..f27a2bef 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -2637,7 +2637,7 @@ impl SKESK { // parameters if the S2K method is not supported, and // we don't know the size of the ESK. let mut esk = php_try!(php.reader.steal_eof() - .map_err(|e| anyhow::Error::from(e))); + .map_err(anyhow::Error::from)); let aead_iv = if s2k_supported && esk.len() >= iv_size { // We know the S2K method, so the parameters have // been parsed into the S2K object. So, `esk` diff --git a/openpgp/src/parse/hashed_reader.rs b/openpgp/src/parse/hashed_reader.rs index 4db0a0ee..2d301b1e 100644 --- a/openpgp/src/parse/hashed_reader.rs +++ b/openpgp/src/parse/hashed_reader.rs @@ -422,7 +422,7 @@ mod test { let mut reader = HashedReader::new(reader, HashesFor::MDC, test.expected.keys().cloned() - .map(|algo| HashingMode::Binary(algo)) + .map(HashingMode::Binary) .collect()); assert_eq!(reader.steal_eof().unwrap(), test.data); @@ -485,7 +485,7 @@ mod test { hash_buffered_reader( reader, &expected.keys().cloned() - .map(|algo| HashingMode::Binary(algo)). + .map(HashingMode::Binary). collect::<Vec<_>>()) .unwrap(); diff --git a/openpgp/src/regex/mod.rs b/openpgp/src/regex/mod.rs index c45e0eb0..31e3c7e3 100644 --- a/openpgp/src/regex/mod.rs +++ b/openpgp/src/regex/mod.rs @@ -308,7 +308,7 @@ fn generate_class(caret: bool, chars: impl Iterator<Item=char>) -> Hir // Pad it out so what we can use windows to get three // characters at a time, and be sure to process all // characters. - .map(|c| Some(c)) + .map(Some) .chain(std::iter::once(None)) .chain(std::iter::once(None)) .collect(); diff --git a/openpgp/src/serialize/stream/dash_escape.rs b/openpgp/src/serialize/stream/dash_escape.rs index 52440b17..c84f3f0c 100644 --- a/openpgp/src/serialize/stream/dash_escape.rs +++ b/openpgp/src/serialize/stream/dash_escape.rs @@ -81,7 +81,7 @@ impl<'a, C: 'a> DashEscapeFilter<'a, C> { } let new_buffer = last_line.map(|l| l.to_vec()) - .unwrap_or_else(|| Vec::new()); + .unwrap_or_else(Vec::new); crate::vec_truncate(&mut self.buffer, 0); self.buffer = new_buffer; diff --git a/openpgp/src/serialize/stream/trim_whitespace.rs b/openpgp/src/serialize/stream/trim_whitespace.rs index 79cf70b8..1236b6f6 100644 --- a/openpgp/src/serialize/stream/trim_whitespace.rs +++ b/openpgp/src/serialize/stream/trim_whitespace.rs @@ -90,7 +90,7 @@ impl<'a, C: 'a> TrailingWSFilter<'a, C> { } let new_buffer = last_line.map(|l| l.to_vec()) - .unwrap_or_else(|| Vec::new()); + .unwrap_or_else(Vec::new); crate::vec_truncate(&mut self.buffer, 0); self.buffer = new_buffer; diff --git a/openpgp/src/types/timestamp.rs b/openpgp/src/types/timestamp.rs index 78c5180f..fb18f082 100644 --- a/openpgp/src/types/timestamp.rs +++ b/openpgp/src/types/timestamp.rs @@ -133,7 +133,7 @@ impl Timestamp { /// Returns `None` if the resulting timestamp is not /// representable. pub fn checked_add(&self, d: Duration) -> Option<Timestamp> { - self.0.checked_add(d.0).map(|v| Self(v)) + self.0.checked_add(d.0).map(Self) } /// Subtracts a duration from this timestamp. @@ -141,7 +141,7 @@ impl Timestamp { /// Returns `None` if the resulting timestamp is not /// representable. pub fn checked_sub(&self, d: Duration) -> Option<Timestamp> { - self.0.checked_sub(d.0).map(|v| Self(v)) + self.0.checked_sub(d.0).map(Self) } /// Rounds down to the given level of precision. |