about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/alloc_system.rs
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-07-14 15:05:59 +0000
committerGitHub <noreply@github.com>2025-07-14 15:05:59 +0000
commit8d6de0b82e95d72e481ae509154eb596a414b93f (patch)
tree65dbd4255eee146788f07955e2f1ce81a38d1e74 /compiler/rustc_codegen_gcc/example/alloc_system.rs
parent1c64211aee1daca8b039ebc62bda1737c1ef3531 (diff)
parentfcd064da752e854258ae30e71c4969ea69490add (diff)
downloadrust-8d6de0b82e95d72e481ae509154eb596a414b93f.tar.gz
rust-8d6de0b82e95d72e481ae509154eb596a414b93f.zip
Fix expect_fun_call producing invalid suggestions (#15122)
Previously expect_fun_call would too eagerly convert cases like
`foo.expect(if | block | match)` into `foo.unwrap_or_else`.
Additionally, it would also add to_string() even though the argument is
being passed into format!() which can accept a &str. I also discovered
some other cases where this lint would either produce invalid results,
or be triggered unnecessarily:

- Clippy would suggest changing expect to unwrap_or_else even if the
expression inside expect contains a return statement
- opt.expect(const_fn()) no longer triggers the lint
- The lint would always add braces to the closure body, even if the body
of expect is a single expression
- opt.expect({"literal"}) used to get turned into
```opt.unwrap_or_else(|| panic!("{}", {"literal"}.to_string()))```

Fixes rust-lang/rust-clippy#15056

changelog: [`expect_fun_call`]: fix expect_fun_call producing invalid
suggestions
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/alloc_system.rs')
0 files changed, 0 insertions, 0 deletions