You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `must_use` attribute can be applied to user-defined composite types
357
-
([`struct`s][struct], [`enum`s][enum], and [`union`s][union]), [functions],
358
-
and [traits].
355
+
The `must_use` attribute can be applied to user-defined composite types ([`struct`s][struct], [`enum`s][enum], and [`union`s][union]), [functions], and [traits].
359
356
360
357
r[attributes.diagnostics.must_use.message]
361
-
The `must_use` attribute may include a message by using the
362
-
[MetaNameValueStr] syntax such as `#[must_use = "example message"]`. The
363
-
message will be given alongside the warning.
358
+
The `must_use` attribute may include a message by using the [MetaNameValueStr] syntax such as `#[must_use = "example message"]`. The message will be given alongside the warning.
364
359
365
360
r[attributes.diagnostics.must_use.type]
366
-
When used on user-defined composite types, if the [expression] of an
367
-
[expression statement] has that type, then the `unused_must_use` lint is
368
-
violated.
361
+
When used on user-defined composite types, if the [expression] of an [expression statement] has that type, then the `unused_must_use` lint is violated.
369
362
370
363
```rust
371
364
#[must_use]
@@ -382,9 +375,7 @@ MustUse::new();
382
375
```
383
376
384
377
r[attributes.diagnostics.must_use.fn]
385
-
When used on a function, if the [expression] of an [expression statement] is a
386
-
[call expression] to that function, then the `unused_must_use` lint is
387
-
violated.
378
+
When used on a function, if the [expression] of an [expression statement] is a [call expression] to that function, then the `unused_must_use` lint is violated.
388
379
389
380
```rust
390
381
#[must_use]
@@ -395,9 +386,7 @@ five();
395
386
```
396
387
397
388
r[attributes.diagnostics.must_use.trait]
398
-
When used on a [trait declaration], a [call expression] of an [expression
399
-
statement] to a function that returns an [impl trait] or a [dyn trait] of that trait violates
400
-
the `unused_must_use` lint.
389
+
When used on a [trait declaration], a [call expression] of an [expression statement] to a function that returns an [impl trait] or a [dyn trait] of that trait violates the `unused_must_use` lint.
401
390
402
391
```rust
403
392
#[must_use]
@@ -413,8 +402,7 @@ get_critical();
413
402
```
414
403
415
404
r[attributes.diagnostics.must_use.trait-function]
416
-
When used on a function in a trait declaration, then the behavior also applies
417
-
when the call expression is a function from an implementation of the trait.
405
+
When used on a function in a trait declaration, then the behavior also applies when the call expression is a function from an implementation of the trait.
0 commit comments