X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_parse%2Fsrc%2Fparser%2Fexpr.rs;h=20d035fba195a7219e62568ae977841e9fc9d51f;hb=c6750e491c683aa208f908c496a675dc2eceb005;hp=148e0a24ec304f5b38793a7f2a07224d21dd3979;hpb=051d1176b786aadd7d7c048f822cb6bfab00fe03;p=rust.git diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 148e0a24ec3..20d035fba19 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -276,7 +276,7 @@ pub(super) fn parse_assoc_expr_with( lhs = self.parse_assoc_op_ascribe(lhs, lhs_span)?; continue; } else if op == AssocOp::DotDot || op == AssocOp::DotDotEq { - // If we didn’t have to handle `x..`/`x..=`, it would be pretty easy to + // If we didn't have to handle `x..`/`x..=`, it would be pretty easy to // generalise it to the Fixity::None code. lhs = self.parse_range_expr(prec, lhs, op, cur_op_span)?; break; @@ -1919,17 +1919,13 @@ fn maybe_suggest_brackets_instead_of_braces( match snapshot.parse_array_or_repeat_expr(attrs, token::Brace) { Ok(arr) => { let hi = snapshot.prev_token.span; - self.struct_span_err( - arr.span, - "this code is interpreted as a block expression, not an array", - ) - .multipart_suggestion( - "try using [] instead of {}", - vec![(lo, "[".to_owned()), (hi, "]".to_owned())], - Applicability::MaybeIncorrect, - ) - .note("to define an array, one would use square brackets instead of curly braces") - .emit(); + self.struct_span_err(arr.span, "this is a block expression, not an array") + .multipart_suggestion( + "to make an array, use square brackets instead of curly braces", + vec![(lo, "[".to_owned()), (hi, "]".to_owned())], + Applicability::MaybeIncorrect, + ) + .emit(); self.restore_snapshot(snapshot); Some(self.mk_expr_err(arr.span))