1
Fork 0

Some "parenthesis" and "parentheses" fixes

This commit is contained in:
r00ster91 2021-10-17 12:04:01 +02:00
parent 7fbd4ce276
commit 3c1d55422a
30 changed files with 100 additions and 100 deletions

View file

@ -1342,10 +1342,10 @@ impl<'a> Parser<'a> {
self.struct_span_err(
MultiSpan::from_spans(vec![begin_par_sp, self.prev_token.span]),
"unexpected parenthesis surrounding `for` loop head",
"unexpected parentheses surrounding `for` loop head",
)
.multipart_suggestion(
"remove parenthesis in `for` loop",
"remove parentheses in `for` loop",
vec![(begin_par_sp, String::new()), (self.prev_token.span, String::new())],
// With e.g. `for (x) in y)` this would replace `(x) in y)`
// with `x) in y)` which is syntactically invalid.

View file

@ -1258,7 +1258,7 @@ impl<'a> Parser<'a> {
/// Parses `pub`, `pub(crate)` and `pub(in path)` plus shortcuts `crate` for `pub(crate)`,
/// `pub(self)` for `pub(in self)` and `pub(super)` for `pub(in super)`.
/// If the following element can't be a tuple (i.e., it's a function definition), then
/// it's not a tuple struct field), and the contents within the parentheses isn't valid,
/// it's not a tuple struct field), and the contents within the parentheses aren't valid,
/// so emit a proper diagnostic.
// Public for rustfmt usage.
pub fn parse_visibility(&mut self, fbt: FollowedByType) -> PResult<'a, Visibility> {

View file

@ -328,7 +328,7 @@ impl<'a> Parser<'a> {
),
)
.multipart_suggestion(
"wrap the expression in parenthesis",
"wrap the expression in parentheses",
suggs,
Applicability::MachineApplicable,
)
@ -349,7 +349,7 @@ impl<'a> Parser<'a> {
"right curly brace `}` before `else` in a `let...else` statement not allowed",
)
.multipart_suggestion(
"try wrapping the expression in parenthesis",
"try wrapping the expression in parentheses",
suggs,
Applicability::MachineApplicable,
)

View file

@ -430,7 +430,7 @@ impl<'a> Parser<'a> {
}
// Parses the `typeof(EXPR)`.
// To avoid ambiguity, the type is surrounded by parenthesis.
// To avoid ambiguity, the type is surrounded by parentheses.
fn parse_typeof_ty(&mut self) -> PResult<'a, TyKind> {
self.expect(&token::OpenDelim(token::Paren))?;
let expr = self.parse_anon_const_expr()?;