Merge commit 'a109190d70' into clippy-subtree-update

This commit is contained in:
Philipp Krones 2024-10-18 13:44:06 +02:00
parent c512a221c2
commit fea5e77da1
179 changed files with 4032 additions and 1752 deletions

View file

@ -341,18 +341,18 @@ fn fn_call_in_nested_expr() {
}
let opt: Option<i32> = Some(1);
//~v ERROR: use of `unwrap_or` followed by a function call
//~v ERROR: function call inside of `unwrap_or`
let _ = opt.unwrap_or_else(f); // suggest `.unwrap_or_else(f)`
//
//~v ERROR: use of `unwrap_or` followed by a function call
//~v ERROR: function call inside of `unwrap_or`
let _ = opt.unwrap_or_else(|| f() + 1); // suggest `.unwrap_or_else(|| f() + 1)`
//
//~v ERROR: use of `unwrap_or` followed by a function call
//~v ERROR: function call inside of `unwrap_or`
let _ = opt.unwrap_or_else(|| {
let x = f();
x + 1
});
//~v ERROR: use of `map_or` followed by a function call
//~v ERROR: function call inside of `map_or`
let _ = opt.map_or_else(|| f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)`
//
//~v ERROR: use of `unwrap_or` to construct default value
@ -361,7 +361,7 @@ fn fn_call_in_nested_expr() {
let opt_foo = Some(Foo {
val: String::from("123"),
});
//~v ERROR: use of `unwrap_or` followed by a function call
//~v ERROR: function call inside of `unwrap_or`
let _ = opt_foo.unwrap_or_else(|| Foo { val: String::default() });
}