mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
2ee713dc7b
Catches up with a change in rust-lang/rust#57537 Happened to fix a bug in `expect_fun_call`, that is the lint ignores more than one arguments to `format`.
46 lines
2.3 KiB
Text
46 lines
2.3 KiB
Text
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:27:26
|
|
|
|
|
LL | with_none_and_format.expect(&format!("Error {}: fake error", error_code));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
|
|
|
|
= note: `-D clippy::expect-fun-call` implied by `-D warnings`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:30:26
|
|
|
|
|
LL | with_none_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", error_code))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:40:25
|
|
|
|
|
LL | with_err_and_format.expect(&format!("Error {}: fake error", error_code));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:43:25
|
|
|
|
|
LL | with_err_and_as_str.expect(format!("Error {}: fake error", error_code).as_str());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("Error {}: fake error", error_code))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:58:17
|
|
|
|
|
LL | Some("foo").expect({ &format!("error") });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { let msg = { &format!("error") }; panic!(msg) }))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:59:17
|
|
|
|
|
LL | Some("foo").expect(format!("error").as_ref());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("error"))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:61:17
|
|
|
|
|
LL | Some("foo").expect(format!("{} {}", 1, 2).as_ref());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{} {}", 1, 2))`
|
|
|
|
error: aborting due to 7 previous errors
|
|
|