clippy keeps complaining about my map_unwrap_or pattern
Running clippy 0.1.78 on some older code and it fires:
warning: use map_or instead of map(...).unwrap_or(...)
--> src/config.rs:27:18
|
27 | let port = raw.get("port").map(|v| v.parse()).unwrap_or(Ok(8080));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: map_or(Ok(8080), |v| v.parse())
I can do that but it reads worse to me. Is this one of those clippy lints people just allow at the crate level? Happy to share more detail if it helps.
4 replies