Suggest replacing patterns with underscores
This commit is contained in:
parent
90a6954327
commit
b05f0bec1a
@ -344,8 +344,11 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
trait_item.id, span,
|
||||
"patterns aren't allowed in methods without bodies");
|
||||
} else {
|
||||
struct_span_err!(self.session, span, E0642,
|
||||
"patterns aren't allowed in methods without bodies").emit();
|
||||
let mut err = struct_span_err!(self.session, span, E0642,
|
||||
"patterns aren't allowed in methods without bodies");
|
||||
err.span_suggestion(span,
|
||||
"use an underscore to ignore the name", "_".to_owned());
|
||||
err.emit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ error[E0642]: patterns aren't allowed in methods without bodies
|
||||
--> $DIR/E0642.rs:12:12
|
||||
|
|
||||
LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
|
||||
| ^^^^^^
|
||||
| ^^^^^^ help: use an underscore to ignore the name: `_`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user