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,
|
trait_item.id, span,
|
||||||
"patterns aren't allowed in methods without bodies");
|
"patterns aren't allowed in methods without bodies");
|
||||||
} else {
|
} else {
|
||||||
struct_span_err!(self.session, span, E0642,
|
let mut err = struct_span_err!(self.session, span, E0642,
|
||||||
"patterns aren't allowed in methods without bodies").emit();
|
"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
|
--> $DIR/E0642.rs:12:12
|
||||||
|
|
|
|
||||||
LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
|
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
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user