Skip to content

Commit 083638c

Browse files
authored
Rollup merge of #77886 - LingMan:ast_pretty_bool_matches, r=petrochenkov
Replace trivial bool matches with the `matches!` macro This derives `PartialEq` on one enum (and two structs it contains) to enable the `==` operator for it. If there's some downside to this, I could respin with the `matches!` macro instead.
2 parents 31135e0 + 7a23a71 commit 083638c

File tree

1 file changed

+2
-8
lines changed
  • compiler/rustc_ast_pretty/src

1 file changed

+2
-8
lines changed

compiler/rustc_ast_pretty/src/pp.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,11 @@ pub enum Token {
170170

171171
impl Token {
172172
crate fn is_eof(&self) -> bool {
173-
match *self {
174-
Token::Eof => true,
175-
_ => false,
176-
}
173+
matches!(self, Token::Eof)
177174
}
178175

179176
pub fn is_hardbreak_tok(&self) -> bool {
180-
match *self {
181-
Token::Break(BreakToken { offset: 0, blank_space: bs }) if bs == SIZE_INFINITY => true,
182-
_ => false,
183-
}
177+
matches!(self, Token::Break(BreakToken { offset: 0, blank_space: SIZE_INFINITY }))
184178
}
185179
}
186180

0 commit comments

Comments
 (0)