1
Fork 0

Skip parenthesis around tuple struct field calls

This commit is contained in:
David Tolnay 2024-12-27 14:25:08 -08:00
parent c95f9f50de
commit 26bb4e6464
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
4 changed files with 11 additions and 3 deletions

View file

@ -2707,6 +2707,12 @@ impl Ident {
pub fn is_raw_guess(self) -> bool {
self.name.can_be_raw() && self.is_reserved()
}
/// Whether this would be the identifier for a tuple field like `self.0`, as
/// opposed to a named field like `self.thing`.
pub fn is_numeric(self) -> bool {
!self.name.is_empty() && self.as_str().bytes().all(|b| b.is_ascii_digit())
}
}
/// Collect all the keywords in a given edition into a vector.