mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 02:23:19 +00:00
94 lines
4.5 KiB
Text
94 lines
4.5 KiB
Text
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:34: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:37: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:37
|
|
|
|
|
LL | with_none_and_format_with_macro.expect(format!("Error {}: fake error", one!()).as_str());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("Error {}: fake error", one!()))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:50: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:53: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:65:17
|
|
|
|
|
LL | Some("foo").expect(format!("{} {}", 1, 2).as_ref());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{} {}", 1, 2))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:86:21
|
|
|
|
|
LL | Some("foo").expect(&get_string());
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_string()) })`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:87:21
|
|
|
|
|
LL | Some("foo").expect(get_string().as_ref());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_string()) })`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:88:21
|
|
|
|
|
LL | Some("foo").expect(get_string().as_str());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_string()) })`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:90:21
|
|
|
|
|
LL | Some("foo").expect(get_static_str());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_static_str()) })`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:91:21
|
|
|
|
|
LL | Some("foo").expect(get_non_static_str(&0));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| { panic!("{}", get_non_static_str(&0).to_string()) })`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:95:16
|
|
|
|
|
LL | Some(true).expect(&format!("key {}, {}", 1, 2));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("key {}, {}", 1, 2))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:101:17
|
|
|
|
|
LL | opt_ref.expect(&format!("{:?}", opt_ref));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{:?}", opt_ref))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:105:20
|
|
|
|
|
LL | format_capture.expect(&format!("{error_code}"));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{error_code}"))`
|
|
|
|
error: use of `expect` followed by a function call
|
|
--> $DIR/expect_fun_call.rs:108:30
|
|
|
|
|
LL | format_capture_and_value.expect(&format!("{error_code}, {}", 1));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("{error_code}, {}", 1))`
|
|
|
|
error: aborting due to 15 previous errors
|
|
|