Merge rust-bitcoin/rust-bitcoin#6675: units: Remove unnecessary track_caller
What changed, and why it matters
This commit removes two Rust compiler hints (`#[track_caller]`) from helper functions that simply return a value or call a user-provided fallback. These functions never panic, so the hints were unnecessary and had no security effect. The change is a minor code cleanup with no functional or security impact.
No action required. This is a non-security cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes #[track_caller] from NumOpResult::unwrap_or and NumOpResult::unwrap_or_else in units/src/result.rs. #[track_caller] only affects panic location reporting; since neither function panics, the attribute was redundant. Removing it does not change behavior, ABI, or error handling. It is purely a lint/cleanup change.
Changed components
units/src/result.rsInspect captured patch +0 / −2
### units/src/result.rs
@@ -153,7 +153,6 @@ impl<T: fmt::Debug> NumOpResult<T> {
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing the result of a
/// function call, it is recommended to use `unwrap_or_else`, which is lazily evaluated.
#[inline]
- #[track_caller]
pub fn unwrap_or(self, default: T) -> T {
match self {
Self::Valid(x) => x,
@@ -163,7 +162,6 @@ impl<T: fmt::Debug> NumOpResult<T> {
/// Returns the contained `Valid` value or computes it from a closure.
#[inline]
- #[track_caller]
pub fn unwrap_or_else<F>(self, f: F) -> T
where
F: FnOnce() -> T,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.