issue 54109: use short suggestions
This commit is contained in:
parent
79919a7ed6
commit
bc63a4a13a
2 changed files with 10 additions and 10 deletions
|
@ -733,7 +733,7 @@ impl<'a> Parser<'a> {
|
||||||
};
|
};
|
||||||
let mut err = self.fatal(&msg_exp);
|
let mut err = self.fatal(&msg_exp);
|
||||||
if self.token.is_ident_named("and") {
|
if self.token.is_ident_named("and") {
|
||||||
err.span_suggestion_with_applicability(
|
err.span_suggestion_short_with_applicability(
|
||||||
self.span,
|
self.span,
|
||||||
"use `&&` instead of `and` for the boolean operator",
|
"use `&&` instead of `and` for the boolean operator",
|
||||||
"&&".to_string(),
|
"&&".to_string(),
|
||||||
|
@ -741,7 +741,7 @@ impl<'a> Parser<'a> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if self.token.is_ident_named("or") {
|
if self.token.is_ident_named("or") {
|
||||||
err.span_suggestion_with_applicability(
|
err.span_suggestion_short_with_applicability(
|
||||||
self.span,
|
self.span,
|
||||||
"use `||` instead of `or` for the boolean operator",
|
"use `||` instead of `or` for the boolean operator",
|
||||||
"||".to_string(),
|
"||".to_string(),
|
||||||
|
@ -4768,7 +4768,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.token.is_ident_named("and") {
|
if self.token.is_ident_named("and") {
|
||||||
e.span_suggestion_with_applicability(
|
e.span_suggestion_short_with_applicability(
|
||||||
self.span,
|
self.span,
|
||||||
"use `&&` instead of `and` for the boolean operator",
|
"use `&&` instead of `and` for the boolean operator",
|
||||||
"&&".to_string(),
|
"&&".to_string(),
|
||||||
|
@ -4776,7 +4776,7 @@ impl<'a> Parser<'a> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if self.token.is_ident_named("or") {
|
if self.token.is_ident_named("or") {
|
||||||
e.span_suggestion_with_applicability(
|
e.span_suggestion_short_with_applicability(
|
||||||
self.span,
|
self.span,
|
||||||
"use `||` instead of `or` for the boolean operator",
|
"use `||` instead of `or` for the boolean operator",
|
||||||
"||".to_string(),
|
"||".to_string(),
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: expected `{`, found `and`
|
||||||
--> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10
|
--> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10
|
||||||
|
|
|
|
||||||
LL | if a and b {
|
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
|
| this `if` statement has a condition, but no block
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ error: expected `{`, found `or`
|
||||||
--> $DIR/issue-54109-and_instead_of_ampersands.rs:23:10
|
--> $DIR/issue-54109-and_instead_of_ampersands.rs:23:10
|
||||||
|
|
|
|
||||||
LL | if a or b {
|
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
|
| this `if` statement has a condition, but no block
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ LL | if (a and b) {
|
||||||
| ^^^
|
| ^^^
|
||||||
| |
|
| |
|
||||||
| expected one of 8 possible tokens here
|
| 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`
|
error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or`
|
||||||
--> $DIR/issue-54109-and_instead_of_ampersands.rs:41:11
|
--> $DIR/issue-54109-and_instead_of_ampersands.rs:41:11
|
||||||
|
@ -30,7 +30,7 @@ LL | if (a or b) {
|
||||||
| ^^
|
| ^^
|
||||||
| |
|
| |
|
||||||
| expected one of 8 possible tokens here
|
| 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`
|
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and`
|
||||||
--> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13
|
--> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13
|
||||||
|
@ -39,7 +39,7 @@ LL | while a and b {
|
||||||
| ^^^
|
| ^^^
|
||||||
| |
|
| |
|
||||||
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
|
| 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`
|
error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or`
|
||||||
--> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13
|
--> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13
|
||||||
|
@ -48,7 +48,7 @@ LL | while a or b {
|
||||||
| ^^
|
| ^^
|
||||||
| |
|
| |
|
||||||
| expected one of `!`, `.`, `::`, `?`, `{`, or an operator here
|
| 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
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue