rust-clippy/tests/ui/manual_map_option_2.stderr

74 lines
1.9 KiB
Text
Raw Normal View History

error: manual implementation of `Option::map`
--> $DIR/manual_map_option_2.rs:8:13
|
LL | let _ = match Some(0) {
| _____________^
LL | | Some(x) => Some({
LL | | let y = (String::new(), String::new());
LL | | (x, y.0)
LL | | }),
LL | | None => None,
LL | | };
| |_____^
|
= note: `-D clippy::manual-map` implied by `-D warnings`
2023-07-01 11:08:01 +00:00
help: try
|
2021-08-14 23:52:59 +00:00
LL ~ let _ = Some(0).map(|x| {
LL + let y = (String::new(), String::new());
LL + (x, y.0)
LL ~ });
|
error: manual implementation of `Option::map`
--> $DIR/manual_map_option_2.rs:50:13
|
LL | let _ = match &s {
| _____________^
LL | | Some(x) => Some({
LL | | if let Some(ref s) = s { (x.clone(), s) } else { panic!() }
LL | | }),
LL | | None => None,
LL | | };
| |_____^
|
2023-07-01 11:08:01 +00:00
help: try
|
2021-08-14 23:52:59 +00:00
LL ~ let _ = s.as_ref().map(|x| {
LL + if let Some(ref s) = s { (x.clone(), s) } else { panic!() }
LL ~ });
|
error: manual implementation of `Option::map`
--> $DIR/manual_map_option_2.rs:62:17
|
LL | let _ = match Some(0) {
| _________________^
LL | | Some(x) => Some(f(x)),
LL | | None => None,
LL | | };
2023-07-01 11:08:01 +00:00
| |_________^ help: try: `Some(0).map(|x| f(x))`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option_2.rs:67:13
|
LL | let _ = match Some(0) {
| _____________^
LL | | Some(x) => unsafe { Some(f(x)) },
LL | | None => None,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `Some(0).map(|x| unsafe { f(x) })`
error: manual implementation of `Option::map`
--> $DIR/manual_map_option_2.rs:71:13
|
LL | let _ = match Some(0) {
| _____________^
LL | | Some(x) => Some(unsafe { f(x) }),
LL | | None => None,
LL | | };
2023-07-01 11:08:01 +00:00
| |_____^ help: try: `Some(0).map(|x| unsafe { f(x) })`
error: aborting due to 5 previous errors