Skip to content

Commit a30f26e

Browse files
committed
Add rule identifiers for unassociated must_use notes
We have two note admonitions at the bottom of the `must_use` section that weren't associated with any particular rule but, by falling below the final rule without identifiers of their own, appeared to be associated with it. Let's give each of these a rule identifier to make this more clear.
1 parent 887affd commit a30f26e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/attributes/diagnostics.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ impl Tr for () {
495495
> [!NOTE]
496496
> `rustc` lints against use on functions in trait implementations. This may become an error in the future.
497497
498+
r[attributes.diagnostics.must_use.wrapping-suppression]
498499
> [!NOTE]
499500
> Wrapping the result of a `#[must_use]` function in certain expressions can suppress the [fn-based check][attributes.diagnostics.must_use.fn], because the [expression] of the [expression statement] is not a [call expression] or [method call expression] to a `#[must_use]` function. The [type-based check][attributes.diagnostics.must_use.type] still applies if the type of the overall expression is `#[must_use]`.
500501
>
@@ -526,6 +527,7 @@ impl Tr for () {
526527
> if true { g() } else { MustUse }; // ERROR: Must be used.
527528
> ```
528529
530+
r[attributes.diagnostics.must_use.underscore-idiom]
529531
> [!NOTE]
530532
> Using a [let statement] or [destructuring assignment] with a pattern of `_` when a must-used value is purposely discarded is idiomatic.
531533
>

0 commit comments

Comments
 (0)