You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #57291 - euclio:method-call-suggestion, r=estebank
use structured suggestion for method calls
Furthermore, don't suggest calling the method if it is part of a place
expression, as this is invalid syntax.
I'm thinking it might be worth putting a label on the method assignment span like "this is a method" and removing the span from the "methods are immutable" text so it isn't reported twice.
The suggestions in `src/test/ui/did_you_mean/issue-40396.stderr` are suboptimal. I could check if the containing expression is `BinOp`, but I'm not sure if that's general enough. Any ideas?
r? @estebank
Copy file name to clipboardExpand all lines: src/test/ui/methods/method-missing-call.stderr
+2-6
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,13 @@ error[E0615]: attempted to take value of method `get_x` on type `Point`
2
2
--> $DIR/method-missing-call.rs:22:26
3
3
|
4
4
LL | .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point`
5
-
| ^^^^^
6
-
|
7
-
= help: maybe a `()` to call it is missing?
5
+
| ^^^^^ help: use parentheses to call the method: `get_x()`
8
6
9
7
error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter<std::iter::Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:25]>, [closure@$DIR/method-missing-call.rs:28:23: 28:35]>`
10
8
--> $DIR/method-missing-call.rs:29:16
11
9
|
12
10
LL | .filter_map; //~ ERROR attempted to take value of method `filter_map` on type
13
-
| ^^^^^^^^^^
14
-
|
15
-
= help: maybe a `()` to call it is missing?
11
+
| ^^^^^^^^^^ help: use parentheses to call the method: `filter_map(...)`
0 commit comments