-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #89055 - Kobzol:wrapped-method-expr-call-parens, r=we…
…sleywiser Suggest better place to add call parentheses for method expressions wrapped in parentheses I wanted to improve the suggestion a bit to both remove the wrapping parentheses **and** add call parentheses by both calling `suggest_method_call` and using `multipart_suggestion`. But I very quickly ran into a problem where multiple overlapping machine applicable suggestions cannot be properly applied together. So I applied the suggestion from the issue and only added the call parentheses directly after the expression. Fixes: #89044
- Loading branch information
Showing
5 changed files
with
47 additions
and
4 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,9 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
let a = Some(42); | ||
println!( | ||
"The value is {}.", | ||
(a.unwrap()) //~ERROR [E0615] | ||
); | ||
} |
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,9 @@ | ||
// run-rustfix | ||
|
||
fn main() { | ||
let a = Some(42); | ||
println!( | ||
"The value is {}.", | ||
(a.unwrap) //~ERROR [E0615] | ||
); | ||
} |
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,14 @@ | ||
error[E0615]: attempted to take value of method `unwrap` on type `Option<{integer}>` | ||
--> $DIR/issue-89044-wrapped-expr-method.rs:7:12 | ||
| | ||
LL | (a.unwrap) | ||
| ^^^^^^ method, not a field | ||
| | ||
help: use parentheses to call the method | ||
| | ||
LL | (a.unwrap()) | ||
| ++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0615`. |