Skip to content

Commit

Permalink
Add must_use to Error constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 7, 2022
1 parent 06826d1 commit 1af20cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl Error {
#[cfg(feature = "std")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
#[cold]
#[must_use]
pub fn new<E>(error: E) -> Self
where
E: StdError + Send + Sync + 'static,
Expand Down Expand Up @@ -72,6 +73,7 @@ impl Error {
/// }
/// ```
#[cold]
#[must_use]
pub fn msg<M>(message: M) -> Self
where
M: Display + Debug + Send + Sync + 'static,
Expand Down Expand Up @@ -293,6 +295,7 @@ impl Error {
/// }
/// ```
#[cold]
#[must_use]
pub fn context<C>(self, context: C) -> Self
where
C: Display + Send + Sync + 'static,
Expand Down

0 comments on commit 1af20cc

Please sign in to comment.