Skip to content

Commit bc63a4a

Browse files
committed
issue 54109: use short suggestions
1 parent 79919a7 commit bc63a4a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/libsyntax/parse/parser.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -733,15 +733,15 @@ impl<'a> Parser<'a> {
733733
};
734734
let mut err = self.fatal(&msg_exp);
735735
if self.token.is_ident_named("and") {
736-
err.span_suggestion_with_applicability(
736+
err.span_suggestion_short_with_applicability(
737737
self.span,
738738
"use `&&` instead of `and` for the boolean operator",
739739
"&&".to_string(),
740740
Applicability::MaybeIncorrect,
741741
);
742742
}
743743
if self.token.is_ident_named("or") {
744-
err.span_suggestion_with_applicability(
744+
err.span_suggestion_short_with_applicability(
745745
self.span,
746746
"use `||` instead of `or` for the boolean operator",
747747
"||".to_string(),
@@ -4768,15 +4768,15 @@ impl<'a> Parser<'a> {
47684768
}
47694769

47704770
if self.token.is_ident_named("and") {
4771-
e.span_suggestion_with_applicability(
4771+
e.span_suggestion_short_with_applicability(
47724772
self.span,
47734773
"use `&&` instead of `and` for the boolean operator",
47744774
"&&".to_string(),
47754775
Applicability::MaybeIncorrect,
47764776
);
47774777
}
47784778
if self.token.is_ident_named("or") {
4779-
e.span_suggestion_with_applicability(
4779+
e.span_suggestion_short_with_applicability(
47804780
self.span,
47814781
"use `||` instead of `or` for the boolean operator",
47824782
"||".to_string(),

src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ error: expected `{`, found `and`
22
--> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10
33
|
44
LL | if a and b {
5-
| -- ^^^ help: use `&&` instead of `and` for the boolean operator: `&&`
5+
| -- ^^^ help: use `&&` instead of `and` for the boolean operator
66
| |
77
| this `if` statement has a condition, but no block
88

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

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

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

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

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

5353
error: aborting due to 6 previous errors
5454

0 commit comments

Comments
 (0)