review comments: change wording
This commit is contained in:
parent
6068478d56
commit
ed08c6a985
2 changed files with 6 additions and 17 deletions
|
|
@ -535,19 +535,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
err.help(&format!("did you mean `{}: &{}`?", snippet, expected));
|
||||
}
|
||||
}
|
||||
hir::Node::Expr(hir::Expr { node: hir::ExprKind::Match(..), .. }) => {
|
||||
// rely on match ergonomics
|
||||
if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(inner.span) {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
"you can rely on match ergonomics and remove the explicit borrow",
|
||||
snippet,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
}
|
||||
hir::Node::Expr(hir::Expr { node: hir::ExprKind::Match(..), .. }) |
|
||||
hir::Node::Pat(_) => {
|
||||
// nested `&&pat`
|
||||
// rely on match ergonomics or it might be nested `&&pat`
|
||||
if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(inner.span) {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
|
|
|
|||
|
|
@ -26,14 +26,13 @@ error[E0308]: mismatched types
|
|||
--> $DIR/match-ergonomics.rs:29:9
|
||||
|
|
||||
LL | &v => {},
|
||||
| ^^ expected i32, found reference
|
||||
| ^^
|
||||
| |
|
||||
| expected i32, found reference
|
||||
| help: you can probably remove the explicit borrow: `v`
|
||||
|
|
||||
= note: expected type `i32`
|
||||
found type `&_`
|
||||
help: you can rely on match ergonomics and remove the explicit borrow
|
||||
|
|
||||
LL | v => {},
|
||||
| ^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/match-ergonomics.rs:40:13
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue