rust-clippy/tests/ui/manual_find_map.stderr

95 lines
4 KiB
Text
Raw Normal View History

2021-01-14 22:36:36 +00:00
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(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:54:10
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.option_field.is_some())
| __________^
LL | | .map(|f| f.option_field.clone().unwrap());
| |_________________________________________________^ help: try: `find_map(|f| f.option_field.clone())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
--> $DIR/manual_find_map.rs:59:10
|
LL | .find(|f| f.ref_field.is_some())
| __________^
LL | | .map(|f| f.ref_field.cloned().unwrap());
| |_______________________________________________^ help: try: `find_map(|f| f.ref_field.cloned())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:64:10
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.ref_field.is_some())
| __________^
LL | | .map(|f| f.ref_field.copied().unwrap());
| |_______________________________________________^ help: try: `find_map(|f| f.ref_field.copied())`
2022-06-04 07:55:33 +00:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:69:10
2022-06-04 07:55:33 +00:00
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.result_field.is_ok())
| __________^
LL | | .map(|f| f.result_field.clone().unwrap());
| |_________________________________________________^ help: try: `find_map(|f| f.result_field.clone().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
--> $DIR/manual_find_map.rs:74:10
|
LL | .find(|f| f.result_field.is_ok())
| __________^
LL | | .map(|f| f.result_field.as_ref().unwrap());
| |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_ref().ok())`
2022-06-04 07:55:33 +00:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:79:10
2022-06-04 07:55:33 +00:00
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.result_field.is_ok())
2022-06-04 07:55:33 +00:00
| __________^
2022-06-04 12:20:41 +00:00
LL | | .map(|f| f.result_field.as_deref().unwrap());
| |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())`
2022-06-04 07:55:33 +00:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:84:10
2022-06-04 07:55:33 +00:00
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.result_field.is_ok())
2022-06-04 07:55:33 +00:00
| __________^
2022-06-04 12:20:41 +00:00
LL | | .map(|f| f.result_field.as_mut().unwrap());
| |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())`
2022-06-04 07:55:33 +00:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:89:10
2022-06-04 07:55:33 +00:00
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.result_field.is_ok())
2022-06-04 07:55:33 +00:00
| __________^
2022-06-04 12:20:41 +00:00
LL | | .map(|f| f.result_field.as_deref_mut().unwrap());
| |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())`
2022-06-04 07:55:33 +00:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2022-06-04 12:20:41 +00:00
--> $DIR/manual_find_map.rs:94:10
2022-06-04 07:55:33 +00:00
|
2022-06-04 12:20:41 +00:00
LL | .find(|f| f.result_field.is_ok())
2022-06-04 07:55:33 +00:00
| __________^
2022-06-04 12:20:41 +00:00
LL | | .map(|f| f.result_field.to_owned().unwrap());
| |____________________________________________________^ help: try: `find_map(|f| f.result_field.to_owned().ok())`
2022-06-04 07:55:33 +00:00
2022-06-04 12:20:41 +00:00
error: aborting due to 12 previous errors
2021-01-14 22:36:36 +00:00