consensus_encoding: Fix test import feature gate
What changed, and why it matters
This is a tiny test-only fix that changes which Rust feature gate guards an import inside unit tests. It has no effect on production code and no security relevance.
No security action needed; this is a normal code-quality fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In consensus_encoding/src/decode/mod.rs, inside the #[cfg(test)] test module, the import use alloc::vec::Vec; was incorrectly gated on feature = "alloc". Because the test module itself is only compiled during cargo test, and the crate’s test harness typically enables std, the alloc feature gate was wrong and caused a clippy warning. The patch changes the gate to feature = "std", matching the other imports in the same test module. This is purely a build/test lint fix.
Changed components
consensus_encoding/src/decode/mod.rs (test module only)Inspect captured patch +1 / −1
diff --git a/consensus_encoding/src/decode/mod.rs b/consensus_encoding/src/decode/mod.rs
index 3065036d..9f1d8a8c 100644
--- a/consensus_encoding/src/decode/mod.rs
+++ b/consensus_encoding/src/decode/mod.rs
@@ -258,7 +258,7 @@ impl<D> From<std::io::Error> for ReadError<D> {
#[cfg(test)]
mod tests {
- #[cfg(feature = "alloc")]
+ #[cfg(feature = "std")]
use alloc::vec::Vec;
#[cfg(feature = "std")]
use std::io::{Cursor, Read};
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.