address code review comments

This commit is contained in:
gaurikholkar 2018-03-12 20:14:37 +05:30
parent 7745b52524
commit 311a8bef6e
3 changed files with 5 additions and 5 deletions

View file

@ -15,6 +15,6 @@ struct FancyNum {
fn main() {
let mut fancy = FancyNum{ num: 5 };
let fancy_ref = &(&mut fancy);
fancy_ref.num = 6;
fancy_ref.num = 6; //~^ ERROR E0594
println!("{}", fancy_ref.num);
}

View file

@ -3,7 +3,7 @@ error[E0594]: cannot assign through `&`-reference `fancy_ref`
|
LL | let fancy_ref = &(&mut fancy);
| ------------- help: consider changing this to be a mutable reference: `&mut`
LL | fancy_ref.num = 6;
LL | fancy_ref.num = 6; //~^ ERROR E0594
| ^^^^^^^^^^^^^^^^^ cannot assign through `&`-reference
error: aborting due to previous error