Skip to content

incorrect hint for expect_fun_call #3839

Closed
@abbychau

Description

@abbychau

example:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: writing tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions