2021-01-30 11:06:34 -06:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:9:19
2021-01-30 11:06:34 -06:00
|
LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|a| to_opt(a))`
|
2023-07-31 16:53:53 -05:00
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:9:28
2023-07-31 16:53:53 -05:00
|
LL | let _ = (0..).find(|n| to_opt(*n).is_some()).map(|a| to_opt(a).unwrap());
| ^^^^^^^^^^
2021-01-30 11:06:34 -06:00
= note: `-D clippy::manual-find-map` implied by `-D warnings`
2023-08-01 07:02:21 -05:00
= help: to override `-D warnings` add `#[allow(clippy::manual_find_map)]`
2021-01-30 11:06:34 -06:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:12:19
2021-01-30 11:06:34 -06:00
|
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))`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:12:29
2023-07-31 16:53:53 -05:00
|
LL | let _ = (0..).find(|&n| to_opt(n).is_some()).map(|a| to_opt(a).expect("hi"));
| ^^^^^^^^^
2021-01-30 11:06:34 -06:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:15:19
2021-01-30 11:06:34 -06:00
|
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())`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:15:29
2023-07-31 16:53:53 -05:00
|
LL | let _ = (0..).find(|&n| to_res(n).is_ok()).map(|a| to_res(a).unwrap_or(1));
| ^^^^^^^^^
2021-01-30 11:06:34 -06:00
2022-06-16 10:39:06 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:18:10
2022-07-18 02:39:37 -05:00
|
LL | .find(|&x| to_ref(to_opt(x)).is_some())
| __________^
LL | | .map(|y| to_ref(to_opt(y)).unwrap());
| |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:18:20
2023-07-31 16:53:53 -05:00
|
LL | .find(|&x| to_ref(to_opt(x)).is_some())
| ^^^^^^^^^^^^^^^^^
2022-07-18 02:39:37 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:21:10
2022-07-18 02:39:37 -05:00
|
LL | .find(|x| to_ref(to_opt(*x)).is_some())
| __________^
LL | | .map(|y| to_ref(to_opt(y)).unwrap());
| |____________________________________________^ help: try: `find_map(|y| *to_ref(to_opt(y)))`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:21:19
2023-07-31 16:53:53 -05:00
|
LL | .find(|x| to_ref(to_opt(*x)).is_some())
| ^^^^^^^^^^^^^^^^^^
2022-07-18 02:39:37 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:25:10
2022-07-18 02:39:37 -05:00
|
LL | .find(|&x| to_ref(to_res(x)).is_ok())
| __________^
LL | | .map(|y| to_ref(to_res(y)).unwrap());
| |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:25:20
2023-07-31 16:53:53 -05:00
|
LL | .find(|&x| to_ref(to_res(x)).is_ok())
| ^^^^^^^^^^^^^^^^^
2022-07-18 02:39:37 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:28:10
2022-07-18 02:39:37 -05:00
|
LL | .find(|x| to_ref(to_res(*x)).is_ok())
| __________^
LL | | .map(|y| to_ref(to_res(y)).unwrap());
| |____________________________________________^ help: try: `find_map(|y| to_ref(to_res(y)).ok())`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:28:19
2023-07-31 16:53:53 -05:00
|
LL | .find(|x| to_ref(to_res(*x)).is_ok())
| ^^^^^^^^^^^^^^^^^^
2022-07-18 02:39:37 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:34:26
2022-07-18 02:39:37 -05:00
|
LL | iter::<Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x)`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:35:27
2022-07-18 02:39:37 -05:00
|
LL | iter::<&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| *x)`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:36:28
2022-07-18 02:39:37 -05:00
|
LL | iter::<&&Option<u8>>().find(|x| x.is_some()).map(|x| x.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| **x)`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:37:27
2022-07-18 02:39:37 -05:00
|
LL | iter::<Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:38:28
2022-07-18 02:39:37 -05:00
|
LL | iter::<&Option<&u8>>().find(|x| x.is_some()).map(|x| x.cloned().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:39:31
2022-07-18 02:39:37 -05:00
|
LL | iter::<&Option<String>>().find(|x| x.is_some()).map(|x| x.as_deref().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:40:31
2022-07-18 02:39:37 -05:00
|
LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned())`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:40:41
2023-07-31 16:53:53 -05:00
|
LL | iter::<Option<&String>>().find(|&x| to_ref(x).is_some()).map(|y| to_ref(y).cloned().unwrap());
| ^^^^^^^^^
2022-07-18 02:39:37 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:42:30
2022-07-18 02:39:37 -05:00
|
LL | iter::<Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:43:31
2022-07-18 02:39:37 -05:00
|
LL | iter::<&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:44:32
2022-07-18 02:39:37 -05:00
|
LL | iter::<&&Result<u8, ()>>().find(|x| x.is_ok()).map(|x| x.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:45:31
2022-07-18 02:39:37 -05:00
|
LL | iter::<Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:46:32
2022-07-18 02:39:37 -05:00
|
LL | iter::<&Result<&u8, ()>>().find(|x| x.is_ok()).map(|x| x.cloned().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.cloned().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:47:35
2022-07-18 02:39:37 -05:00
|
LL | iter::<&Result<String, ()>>().find(|x| x.is_ok()).map(|x| x.as_deref().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|x| x.as_deref().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:48:35
2022-07-18 02:39:37 -05:00
|
LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `find_map(|y| to_ref(y).cloned().ok())`
2023-07-31 16:53:53 -05:00
|
note: the suggestion might change the behavior of the program when merging `filter` and `map`, because this expression potentially contains side effects and will only execute once
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:48:45
2023-07-31 16:53:53 -05:00
|
LL | iter::<Result<&String, ()>>().find(|&x| to_ref(x).is_ok()).map(|y| to_ref(y).cloned().unwrap());
| ^^^^^^^^^
2022-07-18 02:39:37 -05:00
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:96:10
2022-06-16 10:39:06 -05: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(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:101:10
2022-06-16 10:39:06 -05:00
|
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(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:106:10
2022-06-16 10:39:06 -05: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())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:111:10
2022-06-16 10:39:06 -05: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(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:116:10
2022-06-16 10:39:06 -05:00
|
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())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:121:10
2022-06-16 10:39:06 -05:00
|
LL | .find(|f| f.result_field.is_ok())
| __________^
LL | | .map(|f| f.result_field.as_deref().unwrap());
| |____________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:126:10
2022-06-16 10:39:06 -05:00
|
LL | .find(|f| f.result_field.is_ok())
| __________^
LL | | .map(|f| f.result_field.as_mut().unwrap());
| |__________________________________________________^ help: try: `find_map(|f| f.result_field.as_mut().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:131:10
2022-06-16 10:39:06 -05:00
|
LL | .find(|f| f.result_field.is_ok())
| __________^
LL | | .map(|f| f.result_field.as_deref_mut().unwrap());
| |________________________________________________________^ help: try: `find_map(|f| f.result_field.as_deref_mut().ok())`
error: `find(..).map(..)` can be simplified as `find_map(..)`
2024-02-27 08:25:18 -06:00
--> tests/ui/manual_find_map.rs:136:10
2022-06-16 10:39:06 -05:00
|
LL | .find(|f| f.result_field.is_ok())
| __________^
LL | | .map(|f| f.result_field.to_owned().unwrap());
| |____________________________________________________^ help: try: `find_map(|f| f.result_field.to_owned().ok())`
2022-07-18 02:39:37 -05:00
error: aborting due to 30 previous errors
2021-01-30 11:06:34 -06:00