You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
warning: use of `expect` followed by a function call
--> src/main.rs:27:45
|
27 | dotenv::var(format!("{}_{}", ex_id, i)).expect(&format!("key {}_{} not found", ex_id, i))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| panic!("key {}_{} not found", ex_id))`
|
= note: #[warn(clippy::expect_fun_call)] on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
should be panic!("key {}_{} not found", ex_id,i), instead of panic!("key {}_{} not found", ex_id)
The text was updated successfully, but these errors were encountered:
I can't reproduce this on the playground.
What version of Clippy are you using?
fnmain(){let a = 1;let b = 2;let o = Some(true);
o.expect(&format!("key {}, {}", a, b));}
Checking playground v0.0.1 (/playground)
warning: use of `expect` followed by a function call
--> src/main.rs:5:7
|
5 | o.expect(&format!("key {}, {}", a, b));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|| panic!("key {}, {}", a, b))`
|
= note: #[warn(clippy::expect_fun_call)] on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
Finished dev [unoptimized + debuginfo] target(s) in 1.29s
That's the current stable version. I can reproduce the bug locally with that version.
Looks like this has been fixed by #3690 but I'll add a test case to make sure.
example:
should be
panic!("key {}_{} not found", ex_id,i)
, instead ofpanic!("key {}_{} not found", ex_id)
The text was updated successfully, but these errors were encountered: