Remove lifetime from encoder_newtype macro
What changed, and why it matters
This is a small internal Rust macro cleanup. It removes an unnecessary generic lifetime parameter from a macro that wraps existing encoder types. There is no functional change to how data is encoded or decoded, and no security relevance is visible in the commit.
No security action required. Treat as normal code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The encoder_newtype! macro previously generated impl<'e $(, $lt)?> Encoder<'e> for $name$(<$lt>)?. The patch changes it to impl<'e> Encoder<'e> for $name$(<$lt>)?, dropping the optional extra lifetime $lt from the impl block. The commit message explains this is possible because all callers now use 'e as the lifetime, allowing nested encoders with a single lifetime. This is a compile-time type-system simplification; the generated code behavior is unchanged.
Changed components
consensus_encoding/src/encode/mod.rsencoder_newtype! macroInspect captured patch +1 / −1
diff --git a/consensus_encoding/src/encode/mod.rs b/consensus_encoding/src/encode/mod.rs
index a7199d97..3f4cd6df 100644
--- a/consensus_encoding/src/encode/mod.rs
+++ b/consensus_encoding/src/encode/mod.rs
@@ -55,7 +55,7 @@ macro_rules! encoder_newtype{
$(#[$($struct_attr)*])*
pub struct $name$(<$lt>)?($encoder);
- impl<'e $(, $lt)?> $crate::Encoder<'e> for $name$(<$lt>)? {
+ impl<'e> $crate::Encoder<'e> for $name$(<$lt>)? {
#[inline]
fn current_chunk(&self) -> Option<&[u8]> { self.0.current_chunk() }
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.