From b63dc2ad89904e738c5107fcf44f9b8d7ab12e9e Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 21 Jan 2025 16:49:10 +0100 Subject: [PATCH] chore: move SealedHeader::cloned to &H (#13904) --- crates/primitives-traits/src/header/sealed.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/primitives-traits/src/header/sealed.rs b/crates/primitives-traits/src/header/sealed.rs index c7a61f253206..0cae46d3b441 100644 --- a/crates/primitives-traits/src/header/sealed.rs +++ b/crates/primitives-traits/src/header/sealed.rs @@ -96,14 +96,16 @@ impl SealedHeader { let hash = self.hash(); (self.header, hash) } +} - /// Clones the header and returns a new sealed header. - pub fn cloned(self) -> Self +impl SealedHeader<&H> { + /// Maps a `SealedHeader<&H>` to a `SealedHeader` by cloning the header. + pub fn cloned(self) -> SealedHeader where H: Clone, { - let (header, hash) = self.split(); - Self::new(header, hash) + let Self { hash, header } = self; + SealedHeader { hash, header: header.clone() } } }