Use copied instead of map to copy
Clippy emits: warning: you are using an explicit closure for copying elements In one instance we have `map` followed by `flatten`, this can be replaced by the `flat_map` combinator. As suggested use `copied` combinator.
This commit is contained in:
parent
62ccc9102c
commit
27649ba182
|
@ -58,7 +58,7 @@ impl EcdsaSig {
|
|||
pub fn to_vec(&self) -> Vec<u8> {
|
||||
// TODO: add support to serialize to a writer to SerializedSig
|
||||
self.sig.serialize_der()
|
||||
.iter().map(|x| *x)
|
||||
.iter().copied()
|
||||
.chain(iter::once(self.hash_ty as u8))
|
||||
.collect()
|
||||
}
|
||||
|
|
|
@ -675,7 +675,7 @@ impl TaprootMerkleBranch {
|
|||
|
||||
/// Serializes `self` as bytes.
|
||||
pub fn serialize(&self) -> Vec<u8> {
|
||||
self.0.iter().map(|e| e.as_inner()).flatten().map(|x| *x).collect::<Vec<u8>>()
|
||||
self.0.iter().flat_map(|e| e.as_inner()).copied().collect::<Vec<u8>>()
|
||||
}
|
||||
|
||||
/// Appends elements to proof.
|
||||
|
|
Loading…
Reference in New Issue