2021-01-10 14:46:03 +00:00
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:15:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(_) => Some(2),
|
|
|
|
LL | | None::<u32> => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(|_| 2)`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::manual-map` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:20:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(x) => Some(x + 1),
|
|
|
|
LL | | _ => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(|x| x + 1)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:25:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some("") {
|
|
|
|
LL | | Some(x) => Some(x.is_empty()),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some("").map(|x| x.is_empty())`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:30:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(x) = Some(0) {
|
|
|
|
LL | | Some(!x)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(|x| !x)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:37:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(x) => { Some(std::convert::identity(x)) }
|
|
|
|
LL | | None => { None }
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(std::convert::identity)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:42:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(&String::new()) {
|
|
|
|
LL | | Some(x) => Some(str::len(x)),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(&String::new()).map(|x| str::len(x))`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:52:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &Some([0, 1]) {
|
|
|
|
LL | | Some(x) => Some(x[0]),
|
|
|
|
LL | | &None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some([0, 1]).as_ref().map(|x| x[0])`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:57:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &Some(0) {
|
|
|
|
LL | | &Some(x) => Some(x * 2),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(|x| x * 2)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:62:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(String::new()) {
|
|
|
|
LL | | Some(ref x) => Some(x.is_empty()),
|
|
|
|
LL | | _ => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:67:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &&Some(String::new()) {
|
|
|
|
LL | | Some(x) => Some(x.len()),
|
|
|
|
LL | | _ => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:72:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &&Some(0) {
|
|
|
|
LL | | &&Some(x) => Some(x + x),
|
|
|
|
LL | | &&_ => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(|x| x + x)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:85:9
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
2021-02-19 19:04:37 +00:00
|
|
|
LL | / match &mut Some(String::new()) {
|
|
|
|
LL | | Some(x) => Some(x.push_str("")),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_________^ help: try this: `Some(String::new()).as_mut().map(|x| x.push_str(""))`
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:91:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &mut Some(String::new()) {
|
2021-02-19 19:04:37 +00:00
|
|
|
LL | | Some(ref x) => Some(x.len()),
|
2021-01-10 14:46:03 +00:00
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
2021-02-19 19:04:37 +00:00
|
|
|
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:96:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &mut &Some(String::new()) {
|
|
|
|
LL | | Some(x) => Some(x.is_empty()),
|
|
|
|
LL | | &mut _ => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:101:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some((0, 1, 2)) {
|
|
|
|
LL | | Some((x, y, z)) => Some(x + y + z),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:106:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match Some([1, 2, 3]) {
|
|
|
|
LL | | Some([first, ..]) => Some(first),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some([1, 2, 3]).map(|[first, ..]| first)`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:111:5
|
2021-01-10 14:46:03 +00:00
|
|
|
|
|
|
|
|
LL | / match &Some((String::new(), "test")) {
|
|
|
|
LL | | Some((x, y)) => Some((y, x)),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`
|
|
|
|
|
2021-02-28 14:03:21 +00:00
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:169:5
|
2021-02-28 14:03:21 +00:00
|
|
|
|
|
|
|
|
LL | / match Some(0) {
|
|
|
|
LL | | Some(x) => Some(vec![x]),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `Some(0).map(|x| vec![x])`
|
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:174:5
|
2021-02-28 14:03:21 +00:00
|
|
|
|
|
|
|
|
LL | / match option_env!("") {
|
|
|
|
LL | | Some(x) => Some(String::from(x)),
|
|
|
|
LL | | None => None,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `option_env!("").map(String::from)`
|
|
|
|
|
2021-03-30 00:39:28 +00:00
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:194:12
|
2021-03-05 20:57:37 +00:00
|
|
|
|
|
2021-03-30 00:39:28 +00:00
|
|
|
LL | } else if let Some(x) = Some(0) {
|
|
|
|
| ____________^
|
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `{ Some(0).map(|x| x + 1) }`
|
2021-03-05 20:57:37 +00:00
|
|
|
|
|
|
|
error: manual implementation of `Option::map`
|
2022-06-04 09:03:11 +00:00
|
|
|
--> $DIR/manual_map_option.rs:202:12
|
2021-03-05 20:57:37 +00:00
|
|
|
|
|
|
|
|
LL | } else if let Some(x) = Some(0) {
|
|
|
|
| ____________^
|
|
|
|
LL | | Some(x + 1)
|
|
|
|
LL | | } else {
|
|
|
|
LL | | None
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: try this: `{ Some(0).map(|x| x + 1) }`
|
|
|
|
|
|
|
|
error: aborting due to 21 previous errors
|
2021-01-10 14:46:03 +00:00
|
|
|
|