units: Correctly feature guard test code
What changed, and why it matters
This is a minor code-quality fix inside test code only. It adjusts the way optional Rust features are checked so that a warning about an unused import disappears when building with only the 'alloc' feature. There is no change to production code and no security impact.
No security action needed. Treat as a normal code-style/test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies units/src/pow.rs test module. It splits a combined #[cfg(all(feature = "alloc", feature = "serde"))] attribute into two separate #[cfg(feature = ...)] attributes on their own lines, matching the project’s recent style. It also adds #[cfg(feature = "encoding")] to the alloc::string::ToString import to silence a lint when building tests with only the alloc feature. Both changes are confined to test code and do not alter runtime behavior.
Changed components
units/src/pow.rs (test module only)Inspect captured patch +3 / −1
diff --git a/units/src/pow.rs b/units/src/pow.rs
index 2442046e..0bdbce4d 100644
--- a/units/src/pow.rs
+++ b/units/src/pow.rs
@@ -553,6 +553,7 @@ mod tests {
#[cfg(feature = "alloc")]
use alloc::format;
#[cfg(feature = "alloc")]
+ #[cfg(feature = "encoding")]
use alloc::string::ToString;
#[cfg(feature = "std")]
use std::error::Error as _;
@@ -616,7 +617,8 @@ mod tests {
}
#[test]
- #[cfg(all(feature = "alloc", feature = "serde"))]
+ #[cfg(feature = "alloc")]
+ #[cfg(feature = "serde")]
fn u256_serde() {
let check = |uint, hex| {
let json = format!("\"{}\"", hex);
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.