1
Fork 0

Detect Python-like slicing and suggest how to fix

Fix #108215
This commit is contained in:
Hirochika Matsumoto 2023-05-03 22:32:52 +09:00
parent b29a1e00f8
commit e65c060d78
4 changed files with 47 additions and 0 deletions

View file

@ -756,6 +756,11 @@ impl Token {
)
}
/// Returns `true` if the token is the integer literal.
pub fn is_integer_lit(&self) -> bool {
matches!(self.kind, Literal(Lit { kind: LitKind::Integer, .. }))
}
/// Returns `true` if the token is a non-raw identifier for which `pred` holds.
pub fn is_non_raw_ident_where(&self, pred: impl FnOnce(Ident) -> bool) -> bool {
match self.ident() {