-
-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ast_tools): shorten code by hoisting imports (#6903)
Pure refactor.
- Loading branch information
1 parent
07dcc0c
commit 45333bc
Showing
8 changed files
with
54 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
use syn::Ident; | ||
|
||
use super::{ | ||
defs::{EnumDef, StructDef, TypeDef}, | ||
with_either, | ||
}; | ||
use crate::util::ToIdent; | ||
|
||
pub trait GetIdent { | ||
fn ident(&self) -> syn::Ident; | ||
fn ident(&self) -> Ident; | ||
} | ||
|
||
impl GetIdent for TypeDef { | ||
fn ident(&self) -> syn::Ident { | ||
fn ident(&self) -> Ident { | ||
with_either!(self, it => it.ident()) | ||
} | ||
} | ||
|
||
impl GetIdent for StructDef { | ||
fn ident(&self) -> syn::Ident { | ||
fn ident(&self) -> Ident { | ||
self.name.to_ident() | ||
} | ||
} | ||
|
||
impl GetIdent for EnumDef { | ||
fn ident(&self) -> syn::Ident { | ||
fn ident(&self) -> Ident { | ||
self.name.to_ident() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters