-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Description
I think the warning explains it all:
warning: You checked before that `unwrap_err()` cannot fail. Instead of checking and unwrapping, it's better to use `if let` or `match`.
--> tests/delimiters.rs:51:32
|
51 | assert!(m.is_ok(), "{:?}", m.unwrap_err());
| --------- ^^^^^^^^^^^^^^
| |
| the check is happening here
|
= note: `#[warn(clippy::unnecessary_unwrap)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap
I'm not sure if this is intended to act that way, but this is pretty common pattern in tests ("assert success or print the error otherwise).
$ cargo clippy -V
clippy 0.0.212 (69f99e74 2019-12-14)
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion