diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-06-15 22:04:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-15 22:04:56 +0200 |
| commit | d233522418f3195734d0f41d15a5323dd0f0d425 (patch) | |
| tree | 0b740625e267373be2c3fb1070e6db931154aff8 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs | |
| parent | db7d8374c1b6f1e2e8297f43e6a2cbffeff21882 (diff) | |
| parent | 72b3b58efc6ed4bab93ba98586b62750abbdda79 (diff) | |
| download | rust-d233522418f3195734d0f41d15a5323dd0f0d425.tar.gz rust-d233522418f3195734d0f41d15a5323dd0f0d425.zip | |
Rollup merge of #112529 - jieyouxu:block-expr-unused-must-use, r=oli-obk
Extend `unused_must_use` to cover block exprs
Given code like
```rust
#[must_use]
fn foo() -> i32 {
42
}
fn warns() {
{
foo();
}
}
fn does_not_warn() {
{
foo()
};
}
fn main() {
warns();
does_not_warn();
}
```
### Before This PR
```
warning: unused return value of `foo` that must be used
--> test.rs:8:9
|
8 | foo();
| ^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
8 | let _ = foo();
| +++++++
warning: 1 warning emitted
```
### After This PR
```
warning: unused return value of `foo` that must be used
--> test.rs:8:9
|
8 | foo();
| ^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
help: use `let _ = ...` to ignore the resulting value
|
8 | let _ = foo();
| +++++++
warning: unused return value of `foo` that must be used
--> test.rs:14:9
|
14 | foo()
| ^^^^^
|
help: use `let _ = ...` to ignore the resulting value
|
14 | let _ = foo();
| +++++++ +
warning: 2 warnings emitted
```
Fixes #104253.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha256.rs')
0 files changed, 0 insertions, 0 deletions
