]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-82361.rs
Account for method call and indexing when looking for inner-most path in expression
[rust.git] / tests / ui / suggestions / issue-82361.rs
1 // run-rustfix
2
3 fn main() {
4     let a: usize = 123;
5     let b: &usize = &a;
6
7     if true {
8         a
9     } else {
10         b //~ ERROR `if` and `else` have incompatible types [E0308]
11     };
12
13     if true {
14         1
15     } else {
16         &1 //~ ERROR `if` and `else` have incompatible types [E0308]
17     };
18
19     if true {
20         1
21     } else {
22         &mut 1 //~ ERROR `if` and `else` have incompatible types [E0308]
23     };
24 }