diff options
| author | Guillaume Boisseau <Nadrieril@users.noreply.github.com> | 2024-02-07 18:24:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-07 18:24:43 +0100 |
| commit | cc7edbc1e46664619cac98c2effa4ba61fc38b26 (patch) | |
| tree | b9767fdb5d3bcfad9d97d0bf4ded92bb9ec43912 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | f5a36cbd73343516b490bbcaaaec03384ef2cf93 (diff) | |
| parent | a939bad513e6201d7be76c13080fc0cc901bd658 (diff) | |
| download | rust-cc7edbc1e46664619cac98c2effa4ba61fc38b26.tar.gz rust-cc7edbc1e46664619cac98c2effa4ba61fc38b26.zip | |
Rollup merge of #120479 - estebank:issue-61788, r=wesleywiser
Suggest turning `if let` into irrefutable `let` if appropriate
When encountering an `if let` tail expression without an `else` arm for an enum with a single variant, suggest writing an irrefutable `let` binding instead.
```
error[E0317]: `if` may be missing an `else` clause
--> $DIR/irrefutable-if-let-without-else.rs:8:5
|
LL | fn foo(x: Enum) -> i32 {
| --- expected `i32` because of this return type
LL | / if let Enum::Variant(value) = x {
LL | | value
LL | | }
| |_____^ expected `i32`, found `()`
|
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
help: consider using an irrefutable `let` binding instead
|
LL ~ let Enum::Variant(value) = x;
LL ~ value
|
```
Fix #61788.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
