Skip to content

Commit b63dc2a

Browse files
authored
chore: move SealedHeader::cloned to &H (paradigmxyz#13904)
1 parent b0b1d9d commit b63dc2a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

crates/primitives-traits/src/header/sealed.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,16 @@ impl<H: Sealable> SealedHeader<H> {
9696
let hash = self.hash();
9797
(self.header, hash)
9898
}
99+
}
99100

100-
/// Clones the header and returns a new sealed header.
101-
pub fn cloned(self) -> Self
101+
impl<H: Sealable> SealedHeader<&H> {
102+
/// Maps a `SealedHeader<&H>` to a `SealedHeader<H>` by cloning the header.
103+
pub fn cloned(self) -> SealedHeader<H>
102104
where
103105
H: Clone,
104106
{
105-
let (header, hash) = self.split();
106-
Self::new(header, hash)
107+
let Self { hash, header } = self;
108+
SealedHeader { hash, header: header.clone() }
107109
}
108110
}
109111

0 commit comments

Comments
 (0)