Given the following code (playground link):
struct Point {
x: u32,
y: u32
}
fn process_point(Point { x, y: renamed }: Point) {
/* ... */
}
The current warning output is (ignoring non-relevant parts):
warning: unused variable: `renamed`
--> src/lib.rs:6:32
|
6 | fn process_point(Point { x, y: renamed }: Point) {
| ^^^^^^^ help: try ignoring the field: `renamed: _`
Ideally the output should look like:
|
6 | fn process_point(Point { x, y: renamed }: Point) {
| ^^^^^^^ help: try ignoring the field: `y: _`
because using y: renamed: _ does not work (of course).
Using cargo fix is broken by this too, I got the following message (removing the big message about making a bug report to remove clutter):
✖ cg fix --allow-no-vcs
Checking playground v0.1.0 (/Users/alexis/Projects/rust/playground)
warning: failed to automatically apply fixes suggested by rustc to crate `playground`
after fixes were automatically applied the compiler reported errors within these files:
* src/main.rs
The following errors were reported:
error: expected `,`
--> src/main.rs:18:46
|
18 | fn process_point(Point { x: _, y: renamed: _ }: Point) { /* ... */ }
| ----- ^
| |
| while parsing the fields for this pattern
error: aborting due to previous error
...
@rustbot label A-diagnostics C-bug D-incorrect D-invalid-suggestion
Given the following code (playground link):
The current warning output is (ignoring non-relevant parts):
Ideally the output should look like:
because using
y: renamed: _does not work (of course).Using
cargo fixis broken by this too, I got the following message (removing the big message about making a bug report to remove clutter):@rustbot label A-diagnostics C-bug D-incorrect D-invalid-suggestion