Skip to content

Commit cb3e0fb

Browse files
committed
Evaluate place expression in PlaceMention.
1 parent 84bab31 commit cb3e0fb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

tests/ui/option_if_let_else.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn else_if_option(string: Option<&str>) -> Option<(bool, &str)> {
2525
fn unop_bad(string: &Option<&str>, mut num: Option<i32>) {
2626
let _ = string.map_or(0, |s| s.len());
2727
let _ = num.as_ref().map_or(&0, |s| s);
28-
let _ = num.as_mut().map_or(&mut 0, |s| {
28+
let _ = num.as_mut().map_or(&0, |s| {
2929
*s += 1;
3030
s
3131
});
@@ -34,7 +34,7 @@ fn unop_bad(string: &Option<&str>, mut num: Option<i32>) {
3434
s += 1;
3535
s
3636
});
37-
let _ = num.as_mut().map_or(&mut 0, |s| {
37+
let _ = num.as_mut().map_or(&0, |s| {
3838
*s += 1;
3939
s
4040
});

tests/ui/option_if_let_else.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn unop_bad(string: &Option<&str>, mut num: Option<i32>) {
3333
*s += 1;
3434
s
3535
} else {
36-
&mut 0
36+
&0
3737
};
3838
let _ = if let Some(ref s) = num { s } else { &0 };
3939
let _ = if let Some(mut s) = num {
@@ -46,7 +46,7 @@ fn unop_bad(string: &Option<&str>, mut num: Option<i32>) {
4646
*s += 1;
4747
s
4848
} else {
49-
&mut 0
49+
&0
5050
};
5151
}
5252

tests/ui/option_if_let_else.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ LL | let _ = if let Some(s) = &mut num {
3030
LL | | *s += 1;
3131
LL | | s
3232
LL | | } else {
33-
LL | | &mut 0
33+
LL | | &0
3434
LL | | };
3535
| |_____^
3636
|
3737
help: try
3838
|
39-
LL ~ let _ = num.as_mut().map_or(&mut 0, |s| {
39+
LL ~ let _ = num.as_mut().map_or(&0, |s| {
4040
LL + *s += 1;
4141
LL + s
4242
LL ~ });
@@ -76,13 +76,13 @@ LL | let _ = if let Some(ref mut s) = num {
7676
LL | | *s += 1;
7777
LL | | s
7878
LL | | } else {
79-
LL | | &mut 0
79+
LL | | &0
8080
LL | | };
8181
| |_____^
8282
|
8383
help: try
8484
|
85-
LL ~ let _ = num.as_mut().map_or(&mut 0, |s| {
85+
LL ~ let _ = num.as_mut().map_or(&0, |s| {
8686
LL + *s += 1;
8787
LL + s
8888
LL ~ });

0 commit comments

Comments
 (0)