Skip to content

Commit 90572a3

Browse files
committed
Rename Token::is_op as Token::is_punct.
For consistency with `proc_macro::Punct`.
1 parent d711428 commit 90572a3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ impl Token {
404404
[DotDot, DotDotDot, DotDotEq].contains(&self.kind)
405405
}
406406

407-
pub fn is_op(&self) -> bool {
407+
pub fn is_punct(&self) -> bool {
408408
match self.kind {
409409
Eq | Lt | Le | EqEq | Ne | Ge | Gt | AndAnd | OrOr | Not | Tilde | BinOp(_)
410410
| BinOpEq(_) | At | Dot | DotDot | DotDotDot | DotDotEq | Comma | Semi | Colon

compiler/rustc_parse/src/lexer/tokentrees.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ impl<'a> TokenTreesReader<'a> {
5959
if let Some(glued) = self.token.glue(&next_tok) {
6060
self.token = glued;
6161
} else {
62-
let this_spacing =
63-
if next_tok.is_op() { Spacing::Joint } else { Spacing::Alone };
62+
let this_spacing = if next_tok.is_punct() {
63+
Spacing::Joint
64+
} else {
65+
Spacing::Alone
66+
};
6467
break (this_spacing, next_tok);
6568
}
6669
} else {

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ impl<'a> Parser<'a> {
15991599
} else if !ate_colon
16001600
&& self.may_recover()
16011601
&& (matches!(self.token.kind, token::CloseDelim(_) | token::Comma)
1602-
|| self.token.is_op())
1602+
|| self.token.is_punct())
16031603
{
16041604
let (lit, _) =
16051605
self.recover_unclosed_char(label_.ident, Parser::mk_token_lit_char, |self_| {

0 commit comments

Comments
 (0)