about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorGuillaume Boisseau <Nadrieril@users.noreply.github.com>2024-02-07 18:24:43 +0100
committerGitHub <noreply@github.com>2024-02-07 18:24:43 +0100
commitcc7edbc1e46664619cac98c2effa4ba61fc38b26 (patch)
treeb9767fdb5d3bcfad9d97d0bf4ded92bb9ec43912 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parentf5a36cbd73343516b490bbcaaaec03384ef2cf93 (diff)
parenta939bad513e6201d7be76c13080fc0cc901bd658 (diff)
downloadrust-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