refactor(ast): inline AstKind::as_* methods (#5547)

One would hope compiler will inline these trivial methods anyway, but mark them `#[inline]` to make sure.
This commit is contained in:
overlookmotel 2024-09-06 14:31:16 +00:00
parent fefbbc1a5e
commit 14ee086182
2 changed files with 169 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -161,6 +161,7 @@ impl Generator for AstKindGenerator {
format_ident!("as_{}", ident.to_string().to_case(Case::Snake));
parse_quote!(
///@@line_break
#[inline]
pub fn #snake_case_name(&self) -> Option<&'a #typ> {
if let Self::#ident(v) = self {
Some(*v)