Skip to content

Commit 887affd

Browse files
committed
Mention _ destructuring assignment idiom
Now that we support destructuring assignment, using `_ = f()` to suppress a `must_use` lint is also probably idiomatic. Let's mention it.
1 parent f9b0c77 commit 887affd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/attributes/diagnostics.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,14 @@ impl Tr for () {
527527
> ```
528528
529529
> [!NOTE]
530-
> Using a [let statement] with a pattern of `_` when a must-used value is purposely discarded is idiomatic.
530+
> Using a [let statement] or [destructuring assignment] with a pattern of `_` when a must-used value is purposely discarded is idiomatic.
531531
>
532532
> ```rust
533533
> #![deny(unused_must_use)]
534534
> #[must_use]
535535
> fn f() {}
536536
> let _ = f(); // OK.
537+
> _ = f(); // OK.
537538
> ```
538539
539540
r[attributes.diagnostic.namespace]
@@ -744,6 +745,7 @@ The first error message includes a somewhat confusing error message about the re
744745
[attributes]: ../attributes.md
745746
[block expression]: ../expressions/block-expr.md
746747
[call expression]: ../expressions/call-expr.md
748+
[destructuring assignment]: expr.assign.destructure
747749
[method call expression]: ../expressions/method-call-expr.md
748750
[dyn trait]: ../types/trait-object.md
749751
[enum variant]: ../items/enumerations.md

0 commit comments

Comments
 (0)