From 1af20cc4409a6eae6f07d2d29f8c802f81684752 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 7 Mar 2022 12:42:26 -0800 Subject: [PATCH] Add must_use to Error constructors --- src/error.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/error.rs b/src/error.rs index 441b61c..0971146 100644 --- a/src/error.rs +++ b/src/error.rs @@ -26,6 +26,7 @@ impl Error { #[cfg(feature = "std")] #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] #[cold] + #[must_use] pub fn new(error: E) -> Self where E: StdError + Send + Sync + 'static, @@ -72,6 +73,7 @@ impl Error { /// } /// ``` #[cold] + #[must_use] pub fn msg(message: M) -> Self where M: Display + Debug + Send + Sync + 'static, @@ -293,6 +295,7 @@ impl Error { /// } /// ``` #[cold] + #[must_use] pub fn context(self, context: C) -> Self where C: Display + Send + Sync + 'static,