mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 23:06:23 +00:00
73 lines
3.3 KiB
Plaintext
73 lines
3.3 KiB
Plaintext
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:8:19
|
|
|
|
|
LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
|
|
|
|
|
= note: `-D clippy::manual-find-map` implied by `-D warnings`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:11:19
|
|
|
|
|
LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:14:19
|
|
|
|
|
LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_res(a).ok())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:51:24
|
|
|
|
|
LL | let _ = vec.iter().find(|f| f.field.is_some()).map(|f| f.field.clone().unwrap());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|f| f.field.clone())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:56:24
|
|
|
|
|
LL | let _ = vec.iter().find(|f| f.field.is_ok()).map(|f| f.field.clone().unwrap());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|f| f.field.clone().ok())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:58:24
|
|
|
|
|
LL | let _ = vec.iter().find(|f| f.field.is_ok()).map(|f| f.field.as_ref().unwrap());
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|f| f.field.as_ref().ok())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:62:10
|
|
|
|
|
LL | .find(|f| f.field.is_ok())
|
|
| __________^
|
|
LL | | .map(|f| f.field.as_deref().unwrap());
|
|
| |_____________________________________________^ help: try: `find_map(|f| f.field.as_deref().ok())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:67:10
|
|
|
|
|
LL | .find(|f| f.field.is_ok())
|
|
| __________^
|
|
LL | | .map(|f| f.field.as_mut().unwrap());
|
|
| |___________________________________________^ help: try: `find_map(|f| f.field.as_mut().ok())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:72:10
|
|
|
|
|
LL | .find(|f| f.field.is_ok())
|
|
| __________^
|
|
LL | | .map(|f| f.field.as_deref_mut().unwrap());
|
|
| |_________________________________________________^ help: try: `find_map(|f| f.field.as_deref_mut().ok())`
|
|
|
|
error: `find(..).map(..)` can be simplified as `find_map(..)`
|
|
--> $DIR/manual_find_map.rs:77:10
|
|
|
|
|
LL | .find(|f| f.field.is_ok())
|
|
| __________^
|
|
LL | | .map(|f| f.field.to_owned().unwrap());
|
|
| |_____________________________________________^ help: try: `find_map(|f| f.field.to_owned().ok())`
|
|
|
|
error: aborting due to 10 previous errors
|
|
|