7326: Use `is_ident` when converting Path to an Identifier r=edwin0cheng a=kevaundray



Co-authored-by: Kevaundray Wedderburn <kevtheappdev@gmail.com>
This commit is contained in:
bors[bot] 2021-01-18 17:40:11 +00:00 committed by GitHub
commit fcc109e890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,7 @@ impl ModPath {
/// If this path is a single identifier, like `foo`, return its name.
pub fn as_ident(&self) -> Option<&Name> {
if self.kind != PathKind::Plain || self.segments.len() > 1 {
if !self.is_ident() {
return None;
}
self.segments.first()