mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Make is_raw_identifier()
public util function
This commit is contained in:
parent
646f973857
commit
92fdfb548e
3 changed files with 9 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::fmt;
|
||||
|
||||
use syntax::{ast, SmolStr, SyntaxKind};
|
||||
use syntax::{ast, utils::is_raw_identifier, SmolStr};
|
||||
|
||||
/// `Name` is a wrapper around string, which is used in hir for both references
|
||||
/// and declarations. In theory, names should also carry hygiene info, but we are
|
||||
|
@ -33,11 +33,6 @@ impl fmt::Display for Name {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_raw_identifier(name: &str) -> bool {
|
||||
let is_keyword = SyntaxKind::from_keyword(name).is_some();
|
||||
is_keyword && !matches!(name, "self" | "crate" | "super" | "Self")
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for UnescapedName<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match &self.0 .0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue