Skip to content

Commit 940f314

Browse files
committed
Unwrap must_use
1 parent cc7247d commit 940f314

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/attributes/diagnostics.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -349,23 +349,16 @@ r[attributes.diagnostics.must_use]
349349
## The `must_use` attribute
350350

351351
r[attributes.diagnostics.must_use.intro]
352-
The *`must_use` attribute* is used to issue a diagnostic warning when a value
353-
is not "used".
352+
The *`must_use` attribute* is used to issue a diagnostic warning when a value is not "used".
354353

355354
r[attributes.diagnostics.must_use.allowed-positions]
356-
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].
359356

360357
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.
364359

365360
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.
369362

370363
```rust
371364
#[must_use]
@@ -382,9 +375,7 @@ MustUse::new();
382375
```
383376

384377
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.
388379

389380
```rust
390381
#[must_use]
@@ -395,9 +386,7 @@ five();
395386
```
396387

397388
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.
401390

402391
```rust
403392
#[must_use]
@@ -413,8 +402,7 @@ get_critical();
413402
```
414403

415404
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.
418406

419407
```rust
420408
trait Trait {

0 commit comments

Comments
 (0)