Skip to content
Permalink
Browse files

review comments: change wording

  • Loading branch information...
estebank committed Apr 30, 2019
1 parent 6068478 commit ed08c6a985d0f69d2eac33e09440112c880c9fd6
Showing with 6 additions and 17 deletions.
  1. +2 −12 src/librustc_typeck/check/_match.rs
  2. +4 −5 src/test/ui/suggestions/match-ergonomics.stderr
@@ -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

0 comments on commit ed08c6a

Please sign in to comment.
You can’t perform that action at this time.