Change match to *self in Display and Error
What changed, and why it matters
This is a tiny code-style cleanup in error message formatting code. It changes how a Rust error type inspects its own contents when producing text or finding the underlying cause. There is no security-relevant change: the behavior is functionally identical before and after.
No security action needed. Treat as a normal refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit replaces match self { ... } with match *self { ... } in two impl blocks for FromStrError in primitives/src/witness_version.rs. In Rust, matching on self (a reference) versus *self (the dereferenced value) with identical patterns that use ref bindings produces the same result. The change may silence a compiler lint or simplify generated code slightly, but it does not alter control flow, data exposure, or error propagation.
Changed components
primitives/src/witness_version.rsInspect captured patch +2 / −2
diff --git a/primitives/src/witness_version.rs b/primitives/src/witness_version.rs
index ee129e59..a3ab323f 100644
--- a/primitives/src/witness_version.rs
+++ b/primitives/src/witness_version.rs
@@ -165,7 +165,7 @@ pub mod error {
impl fmt::Display for FromStrError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self {
+ match *self {
Self::Unparsable(ref e) => write_err!(f, "integer parse error"; e),
Self::Invalid(ref e) => write_err!(f, "invalid version number"; e),
}
@@ -175,7 +175,7 @@ pub mod error {
#[cfg(feature = "std")]
impl std::error::Error for FromStrError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- match self {
+ match *self {
Self::Unparsable(ref e) => Some(e),
Self::Invalid(ref e) => Some(e),
}
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.