Skip to content

Commit

Permalink
address return_self_not_must_use (#1296)
Browse files Browse the repository at this point in the history
  • Loading branch information
demoray authored Jun 7, 2023
1 parent d8073da commit f91232b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/core/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl Error {

/// Create a new `Error` based on a specific error kind and an underlying error cause
/// along with a message
#[must_use]
pub fn full<E, C>(kind: ErrorKind, error: E, message: C) -> Self
where
E: Into<Box<dyn std::error::Error + Send + Sync>>,
Expand All @@ -106,6 +107,7 @@ impl Error {
}

/// Create an `Error` based on an error kind and some sort of message
#[must_use]
pub fn message<C>(kind: ErrorKind, message: C) -> Self
where
C: Into<Cow<'static, str>>,
Expand All @@ -119,6 +121,7 @@ impl Error {
}

/// Creates an `Error` based on an error kind and formatted message
#[must_use]
pub fn with_message<F, C>(kind: ErrorKind, message: F) -> Self
where
Self: Sized,
Expand All @@ -134,6 +137,7 @@ impl Error {
}

/// Wrap this error in additional `message`
#[must_use]
pub fn context<C>(self, message: C) -> Self
where
C: Into<Cow<'static, str>>,
Expand All @@ -142,6 +146,7 @@ impl Error {
}

/// Wrap this error in additional message
#[must_use]
pub fn with_context<F, C>(self, f: F) -> Self
where
F: FnOnce() -> C,
Expand Down
1 change: 1 addition & 0 deletions sdk/core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ macro_rules! setters {
#[allow(clippy::redundant_field_names)]
#[allow(clippy::needless_update)]
#[allow(missing_docs)]
#[must_use]
pub fn $name<P: ::std::convert::Into<$typ>>(self, $name: P) -> Self {
let $name: $typ = $name.into();
Self {
Expand Down

0 comments on commit f91232b

Please sign in to comment.