2763a0541c
When encountering a E0382 borrow error involving an `Option` or `Result` provide a suggestion to use `.as_ref()` on the prior move location to avoid the move. Fix #84165.
14 lines
232 B
Rust
14 lines
232 B
Rust
// run-rustfix
|
|
|
|
struct Struct;
|
|
|
|
fn bar(_: &Struct) -> Struct {
|
|
Struct
|
|
}
|
|
|
|
fn main() {
|
|
let foo = Some(Struct);
|
|
let _x: Option<Struct> = foo.as_ref().map(|s| bar(&s));
|
|
let _y = foo; //~ERROR use of moved value: `foo`
|
|
}
|