Turn some functions from token.rs into methods on Ident

This commit is contained in:
Vadim Petrochenkov
2018-05-13 16:14:43 +03:00
parent f4cbc2388f
commit c4352ff198
10 changed files with 80 additions and 67 deletions

View File

@@ -107,8 +107,7 @@ impl Path {
// or starts with something like `self`/`super`/`$crate`/etc.
pub fn make_root(&self) -> Option<PathSegment> {
if let Some(ident) = self.segments.get(0).map(|seg| seg.ident) {
if ::parse::token::is_path_segment_keyword(ident) &&
ident.name != keywords::Crate.name() {
if ident.is_path_segment_keyword() && ident.name != keywords::Crate.name() {
return None;
}
}