Annotate qualifying functions with #[must_use]
What changed, and why it matters
This commit adds Rust compiler hints (#[must_use]) to five small helper functions that simply convert numbers from one type to another or create an empty container. The change only produces new compiler warnings when a caller ignores the returned value; it does not change how any existing code behaves at runtime and does not fix an active security bug.
No security action required. Treat as a normal code-quality improvement; review downstream CI for any new #[must_use] warnings if the project denies warnings.
Security signals we found
No security signals present in the diff or commit message.
Change is a linting/ergonomics improvement, not a vulnerability remediation.
Evidence from the diff
The patch annotates ArrayVec::new(), u16_to_u64(), u32_to_u64(), i16_to_i64(), and u16_to_u32() with #[must_use]. These are pure, side-effect-free functions; the annotation turns silent ignored-return-value mistakes into compile-time warnings. There is no functional or runtime change, no memory-safety fix, and no cryptographic change.
Changed components
internals/src/array_vec.rsinternals/src/const_casts.rsInspect captured patch +5 / −0
diff --git a/internals/src/array_vec.rs b/internals/src/array_vec.rs
index 5f5babf5..a4336576 100644
--- a/internals/src/array_vec.rs
+++ b/internals/src/array_vec.rs
@@ -21,6 +21,7 @@ mod safety_boundary {
impl<T: Copy, const CAP: usize> ArrayVec<T, CAP> {
/// Constructs an empty `ArrayVec`.
+ #[must_use]
pub const fn new() -> Self { Self { len: 0, data: [MaybeUninit::uninit(); CAP] } }
/// Constructs a new `ArrayVec` initialized with the contents of `slice`.
diff --git a/internals/src/const_casts.rs b/internals/src/const_casts.rs
index 03ca18da..6ef95488 100644
--- a/internals/src/const_casts.rs
+++ b/internals/src/const_casts.rs
@@ -6,13 +6,17 @@
//! clear while maintaining compile-time evaluation capabilities.
/// Converts `u16` to `u64`
+#[must_use]
pub const fn u16_to_u64(value: u16) -> u64 { value as u64 }
/// Converts `u32` to `u64`
+#[must_use]
pub const fn u32_to_u64(value: u32) -> u64 { value as u64 }
/// Converts `i16` to `i64`
+#[must_use]
pub const fn i16_to_i64(value: i16) -> i64 { value as i64 }
/// Converts `u16` to `u32`
+#[must_use]
pub const fn u16_to_u32(value: u16) -> u32 { value as u32 }
Why this scored 19/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.