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.
This commit is contained in:
@@ -170,17 +170,11 @@ pub enum Token {
|
|||||||
|
|
||||||
impl Token {
|
impl Token {
|
||||||
crate fn is_eof(&self) -> bool {
|
crate fn is_eof(&self) -> bool {
|
||||||
match *self {
|
matches!(self, Token::Eof)
|
||||||
Token::Eof => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_hardbreak_tok(&self) -> bool {
|
pub fn is_hardbreak_tok(&self) -> bool {
|
||||||
match *self {
|
matches!(self, Token::Break(BreakToken { offset: 0, blank_space: SIZE_INFINITY }))
|
||||||
Token::Break(BreakToken { offset: 0, blank_space: bs }) if bs == SIZE_INFINITY => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user