Skip to content

Commit

Permalink
issue 54109: use short suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
vi committed Sep 14, 2018
1 parent 79919a7 commit bc63a4a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,15 +733,15 @@ impl<'a> Parser<'a> {
};
let mut err = self.fatal(&msg_exp);
if self.token.is_ident_named("and") {
err.span_suggestion_with_applicability(
err.span_suggestion_short_with_applicability(
self.span,
"use `&&` instead of `and` for the boolean operator",
"&&".to_string(),
Applicability::MaybeIncorrect,
);
}
if self.token.is_ident_named("or") {
err.span_suggestion_with_applicability(
err.span_suggestion_short_with_applicability(
self.span,
"use `||` instead of `or` for the boolean operator",
"||".to_string(),
Expand Down Expand Up @@ -4768,15 +4768,15 @@ impl<'a> Parser<'a> {
}

if self.token.is_ident_named("and") {
e.span_suggestion_with_applicability(
e.span_suggestion_short_with_applicability(
self.span,
"use `&&` instead of `and` for the boolean operator",
"&&".to_string(),
Applicability::MaybeIncorrect,
);
}
if self.token.is_ident_named("or") {
e.span_suggestion_with_applicability(
e.span_suggestion_short_with_applicability(
self.span,
"use `||` instead of `or` for the boolean operator",
"||".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ error: expected `{`, found `and`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10
|
LL | if a and b {
| -- ^^^ help: use `&&` instead of `and` for the boolean operator: `&&`
| -- ^^^ help: use `&&` instead of `and` for the boolean operator
| |
| this `if` statement has a condition, but no block

error: expected `{`, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:23:10
|
LL | if a or b {
| -- ^^ help: use `||` instead of `or` for the boolean operator: `||`
| -- ^^ help: use `||` instead of `or` for the boolean operator
| |
| this `if` statement has a condition, but no block

Expand All @@ -21,7 +21,7 @@ LL | if (a and b) {
| ^^^
| |
| expected one of 8 possible tokens here
| help: use `&&` instead of `and` for the boolean operator: `&&`
| help: use `&&` instead of `and` for the boolean operator

error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:41:11
Expand All @@ -30,7 +30,7 @@ LL | if (a or b) {
| ^^
| |
| expected one of 8 possible tokens here
| help: use `||` instead of `or` for the boolean operator: `||`
| help: use `||` instead of `or` for the boolean operator

error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13
Expand All @@ -39,7 +39,7 @@ LL | while a and b {
| ^^^
| |
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
| help: use `&&` instead of `and` for the boolean operator: `&&`
| help: use `&&` instead of `and` for the boolean operator

error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
--> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13
Expand All @@ -48,7 +48,7 @@ LL | while a or b {
| ^^
| |
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
| help: use `||` instead of `or` for the boolean operator: `||`
| help: use `||` instead of `or` for the boolean operator

error: aborting due to 6 previous errors

0 comments on commit bc63a4a

Please sign in to comment.