-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #107671 - CastilloDel:master, r=estebank
Fix suggestions rendering when the diff span is multiline Fixes #92741 cc `@estebank` I think, I finally fixed. I still want to go back and try to clean up the code a bit. I'm open to suggestions. Some examples of the new suggestions: ``` help: consider removing the borrow | 2 - & | ``` ``` help: consider removing the borrow | 2 - & 3 - mut | ``` ``` help: consider removing the borrow | 2 - & 3 - mut if true { true } else { false } 2 + if true { true } else { false } | ``` Should we add a test to ensure this behavior doesn't disappear in the future?
- Loading branch information
Showing
5 changed files
with
137 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// run-rustfix | ||
fn main() {} | ||
fn _foo() -> bool { | ||
if true { true } else { false } | ||
} | ||
|
||
fn _bar() -> bool { | ||
if true { true } else { false } | ||
} | ||
|
||
fn _baz() -> bool { | ||
if true { true } else { false } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// run-rustfix | ||
fn main() {} | ||
fn _foo() -> bool { | ||
& //~ ERROR 4:5: 6:36: mismatched types [E0308] | ||
mut | ||
if true { true } else { false } | ||
} | ||
|
||
fn _bar() -> bool { | ||
& //~ ERROR 10:5: 11:40: mismatched types [E0308] | ||
mut if true { true } else { false } | ||
} | ||
|
||
fn _baz() -> bool { | ||
& mut //~ ERROR 15:5: 16:36: mismatched types [E0308] | ||
if true { true } else { false } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-92741.rs:4:5 | ||
| | ||
LL | fn _foo() -> bool { | ||
| ---- expected `bool` because of return type | ||
LL | / & | ||
LL | | mut | ||
LL | | if true { true } else { false } | ||
| |___________________________________^ expected `bool`, found `&mut bool` | ||
| | ||
help: consider removing the borrow | ||
| | ||
LL - & | ||
LL - mut | ||
| | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-92741.rs:10:5 | ||
| | ||
LL | fn _bar() -> bool { | ||
| ---- expected `bool` because of return type | ||
LL | / & | ||
LL | | mut if true { true } else { false } | ||
| |_______________________________________^ expected `bool`, found `&mut bool` | ||
| | ||
help: consider removing the borrow | ||
| | ||
LL - & | ||
LL - mut if true { true } else { false } | ||
LL + if true { true } else { false } | ||
| | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-92741.rs:15:5 | ||
| | ||
LL | fn _baz() -> bool { | ||
| ---- expected `bool` because of return type | ||
LL | / & mut | ||
LL | | if true { true } else { false } | ||
| |___________________________________^ expected `bool`, found `&mut bool` | ||
| | ||
help: consider removing the borrow | ||
| | ||
LL - & mut | ||
| | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |