Skip to content

Commit 05d4de9

Browse files
authored
Rollup merge of rust-lang#58262 - taiki-e:must_use, r=estebank
Add #[must_use] message to Fn* traits This PR adds `#[must_use]` message to `Fn*` traits. Related: rust-lang#57549 r? @estebank
2 parents a85cfaa + 1d05f81 commit 05d4de9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libcore/ops/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
label="expected an `Fn<{Args}>` closure, found `{Self}`",
6363
)]
6464
#[fundamental] // so that regex can rely that `&str: !FnMut`
65-
#[must_use]
65+
#[must_use = "closures are lazy and do nothing unless called"]
6666
pub trait Fn<Args> : FnMut<Args> {
6767
/// Performs the call operation.
6868
#[unstable(feature = "fn_traits", issue = "29625")]
@@ -141,7 +141,7 @@ pub trait Fn<Args> : FnMut<Args> {
141141
label="expected an `FnMut<{Args}>` closure, found `{Self}`",
142142
)]
143143
#[fundamental] // so that regex can rely that `&str: !FnMut`
144-
#[must_use]
144+
#[must_use = "closures are lazy and do nothing unless called"]
145145
pub trait FnMut<Args> : FnOnce<Args> {
146146
/// Performs the call operation.
147147
#[unstable(feature = "fn_traits", issue = "29625")]
@@ -220,7 +220,7 @@ pub trait FnMut<Args> : FnOnce<Args> {
220220
label="expected an `FnOnce<{Args}>` closure, found `{Self}`",
221221
)]
222222
#[fundamental] // so that regex can rely that `&str: !FnMut`
223-
#[must_use]
223+
#[must_use = "closures are lazy and do nothing unless called"]
224224
pub trait FnOnce<Args> {
225225
/// The returned type after the call operator is used.
226226
#[stable(feature = "fn_once_output", since = "1.12.0")]

0 commit comments

Comments
 (0)