2021-02-25 10:25:22 +00:00
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:14:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(_) => Some(2),
|
|
|
|
LL | | None::<u32> => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(|_| 2)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-map` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_map)]`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:19:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(x) => Some(x + 1),
|
|
|
|
LL | | _ => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(|x| x + 1)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:24:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some("") {
|
|
|
|
LL | | Some(x) => Some(x.is_empty()),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some("").map(|x| x.is_empty())`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:29:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(x) = Some(0) {
|
|
|
|
LL | | Some(!x)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(|x| !x)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:36:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(x) => { Some(std::convert::identity(x)) }
|
|
|
|
LL | | None => { None }
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(std::convert::identity)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:41:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(&String::new()) {
|
|
|
|
LL | | Some(x) => Some(str::len(x)),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(&String::new()).map(|x| str::len(x))`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:51:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &Some([0, 1]) {
|
|
|
|
LL | | Some(x) => Some(x[0]),
|
|
|
|
LL | | &None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some([0, 1]).as_ref().map(|x| x[0])`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:56:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &Some(0) {
|
|
|
|
LL | | &Some(x) => Some(x * 2),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(|x| x * 2)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:61:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(String::new()) {
|
|
|
|
LL | | Some(ref x) => Some(x.is_empty()),
|
|
|
|
LL | | _ => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.is_empty())`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:66:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &&Some(String::new()) {
|
|
|
|
LL | | Some(x) => Some(x.len()),
|
|
|
|
LL | | _ => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.len())`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:71:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &&Some(0) {
|
|
|
|
LL | | &&Some(x) => Some(x + x),
|
|
|
|
LL | | &&_ => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(|x| x + x)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:84:9
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &mut Some(String::new()) {
|
|
|
|
LL | | Some(x) => Some(x.push_str("")),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_________^ help: try: `Some(String::new()).as_mut().map(|x| x.push_str(""))`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:90:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &mut Some(String::new()) {
|
|
|
|
LL | | Some(ref x) => Some(x.len()),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.len())`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:95:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &mut &Some(String::new()) {
|
|
|
|
LL | | Some(x) => Some(x.is_empty()),
|
|
|
|
LL | | &mut _ => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.is_empty())`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:100:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some((0, 1, 2)) {
|
|
|
|
LL | | Some((x, y, z)) => Some(x + y + z),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:105:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match Some([1, 2, 3]) {
|
|
|
|
LL | | Some([first, ..]) => Some(first),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some([1, 2, 3]).map(|[first, ..]| first)`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:110:5
|
2021-02-25 10:25:22 +00:00
|
|
|
|
|
|
|
|
LL | / match &Some((String::new(), "test")) {
|
|
|
|
LL | | Some((x, y)) => Some((y, x)),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`
|
2021-02-25 10:25:22 +00:00
|
|
|
|
2021-03-12 14:30:50 +00:00
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:168:5
|
2021-03-12 14:30:50 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(x) => Some(vec![x]),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `Some(0).map(|x| vec![x])`
|
2021-03-12 14:30:50 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:173:5
|
2021-03-12 14:30:50 +00:00
|
|
|
|
|
|
|
|
LL | / match option_env!("") {
|
|
|
|
LL | | Some(x) => Some(String::from(x)),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `option_env!("").map(String::from)`
|
2021-03-12 14:30:50 +00:00
|
|
|
|
2021-04-08 15:50:13 +00:00
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:193:12
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
2021-04-08 15:50:13 +00:00
|
|
|
LL | } else if let Some(x) = Some(0) {
|
|
|
|
| ____________^
|
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `{ Some(0).map(|x| x + 1) }`
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_map_option.rs:201:12
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
|
LL | } else if let Some(x) = Some(0) {
|
|
|
|
| ____________^
|
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
2023-07-17 08:19:29 +00:00
|
|
|
| |_____^ help: try: `{ Some(0).map(|x| x + 1) }`
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
error: aborting due to 21 previous errors
|
2021-02-25 10:25:22 +00:00
|
|
|
|