Skip to content

Commit ed08c6a

Browse files
committed
review comments: change wording
1 parent 6068478 commit ed08c6a

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/librustc_typeck/check/_match.rs

+2-12
Original file line numberDiff line numberDiff line change
@@ -535,19 +535,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
535535
err.help(&format!("did you mean `{}: &{}`?", snippet, expected));
536536
}
537537
}
538-
hir::Node::Expr(hir::Expr { node: hir::ExprKind::Match(..), .. }) => {
539-
// rely on match ergonomics
540-
if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(inner.span) {
541-
err.span_suggestion(
542-
pat.span,
543-
"you can rely on match ergonomics and remove the explicit borrow",
544-
snippet,
545-
Applicability::MaybeIncorrect,
546-
);
547-
}
548-
}
538+
hir::Node::Expr(hir::Expr { node: hir::ExprKind::Match(..), .. }) |
549539
hir::Node::Pat(_) => {
550-
// nested `&&pat`
540+
// rely on match ergonomics or it might be nested `&&pat`
551541
if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(inner.span) {
552542
err.span_suggestion(
553543
pat.span,

src/test/ui/suggestions/match-ergonomics.stderr

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,13 @@ error[E0308]: mismatched types
2626
--> $DIR/match-ergonomics.rs:29:9
2727
|
2828
LL | &v => {},
29-
| ^^ expected i32, found reference
29+
| ^^
30+
| |
31+
| expected i32, found reference
32+
| help: you can probably remove the explicit borrow: `v`
3033
|
3134
= note: expected type `i32`
3235
found type `&_`
33-
help: you can rely on match ergonomics and remove the explicit borrow
34-
|
35-
LL | v => {},
36-
| ^
3736

3837
error[E0308]: mismatched types
3938
--> $DIR/match-ergonomics.rs:40:13

0 commit comments

Comments
 (0)