about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/docs/dev/debugging.md
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-20 10:55:30 +0000
committerPhilipp Krones <hello@philkrones.com>2023-08-17 17:50:36 +0200
commit3a86898bc5a0d346a948625d51b8130a227b714e (patch)
tree098ea717b3c9e54c05a182b1803689ec97f8f584 /src/tools/rust-analyzer/docs/dev/debugging.md
parente8d5b1e66ef84a75a0627f02938001f7719ba9b8 (diff)
Auto merge of #11106 - syvb:literal_unwrap_ice, r=dswij
[`unnecessary_literal_unwrap`]: Fix ICE on None.unwrap_or_default()

Fixes #11099
Fixes #11064

I'm running into #11099 (cc `@y21)` on my Rust codebase. Clippy ICEs on this code when evaluating the `unnecessary_literal_unwrap` lint:
```rust
fn main() {
    let val1: u8 = None.unwrap_or_default();
}
```

This fixes that ICE and adds an message specifically for that case:

```
error: used `unwrap_or_default()` on `None` value
  --> $DIR/unnecessary_literal_unwrap.rs:26:5
   |
LL |     None::<String>.unwrap_or_default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap_or_default()`: `String::default()`
```

This PR also fixes the same ICE with `None.unwrap_or_else` (by giving the generic error message for the lint in that case).

changelog: Fix ICE in `unnecessary_literal_unwrap` on `None.unwrap_or_default()`
Diffstat (limited to 'src/tools/rust-analyzer/docs/dev/debugging.md')
0 files changed, 0 insertions, 0 deletions