From 03a993492145eebcc79a4aad81506a13dcb08c1f Mon Sep 17 00:00:00 2001 From: Andreas Bigger Date: Sun, 1 Feb 2026 19:05:23 -0500 Subject: [PATCH] chore: add #[must_use] to error type constructors Add #[must_use] attribute to CodecError::new() and ValidationError::new() to ensure callers use the returned error value, consistent with other constructor methods in the codebase. --- crates/rpc/src/validator.rs | 1 + crates/traits/src/codec.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/rpc/src/validator.rs b/crates/rpc/src/validator.rs index e826ccd..57ac2ad 100644 --- a/crates/rpc/src/validator.rs +++ b/crates/rpc/src/validator.rs @@ -22,6 +22,7 @@ pub struct ValidationError { impl ValidationError { /// Create a new validation error. + #[must_use] pub fn new(code: i64, message: impl Into) -> Self { Self { code, message: message.into() } } diff --git a/crates/traits/src/codec.rs b/crates/traits/src/codec.rs index 26dd0c6..c43980d 100644 --- a/crates/traits/src/codec.rs +++ b/crates/traits/src/codec.rs @@ -11,6 +11,7 @@ pub struct CodecError(pub String); impl CodecError { /// Create a new codec error. + #[must_use] pub fn new(msg: impl Into) -> Self { Self(msg.into()) }