rust/tests/ui/manual_map_option_2.stderr
Jason Newcomb 9500974bdb
Fix tracking of which locals would need to be captured in a closure.
* Captures by sub closures are now considered
* Copy types are correctly borrowed by reference when their value is used
* Fields are no longer automatically borrowed by value
* Bindings in `match` and `let` patterns are now checked to determine how a local is captured
2021-08-14 19:49:57 -04:00

44 lines
1.1 KiB
Plaintext

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`
help: try this
|
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 | | };
| |_____^
|
help: try this
|
LL | let _ = s.as_ref().map(|x| {
LL | if let Some(ref s) = s { (x.clone(), s) } else { panic!() }
LL | });
|
error: aborting due to 2 previous errors