Skip to content

Commit 03a9934

Browse files
committed
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.
1 parent 6617055 commit 03a9934

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

crates/rpc/src/validator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub struct ValidationError {
2222

2323
impl ValidationError {
2424
/// Create a new validation error.
25+
#[must_use]
2526
pub fn new(code: i64, message: impl Into<String>) -> Self {
2627
Self { code, message: message.into() }
2728
}

crates/traits/src/codec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub struct CodecError(pub String);
1111

1212
impl CodecError {
1313
/// Create a new codec error.
14+
#[must_use]
1415
pub fn new(msg: impl Into<String>) -> Self {
1516
Self(msg.into())
1617
}

0 commit comments

Comments
 (0)