mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 13:30:49 -05:00
Use CompactString for Identifier (#12101)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
use compact_str::CompactString;
|
||||
use std::fmt::Display;
|
||||
|
||||
use rustc_hash::{FxBuildHasher, FxHashSet};
|
||||
|
||||
use ruff_python_ast::name::Name;
|
||||
use ruff_python_ast::{
|
||||
self as ast, ExceptHandler, Expr, ExprContext, IpyEscapeKind, Operator, Stmt, WithItem,
|
||||
};
|
||||
@@ -623,7 +625,7 @@ impl<'src> Parser<'src> {
|
||||
let range = self.node_range(start);
|
||||
return ast::Alias {
|
||||
name: ast::Identifier {
|
||||
id: "*".into(),
|
||||
id: Name::new_static("*"),
|
||||
range,
|
||||
},
|
||||
asname: None,
|
||||
@@ -669,7 +671,7 @@ impl<'src> Parser<'src> {
|
||||
fn parse_dotted_name(&mut self) -> ast::Identifier {
|
||||
let start = self.node_start();
|
||||
|
||||
let mut dotted_name = self.parse_identifier().id;
|
||||
let mut dotted_name: CompactString = self.parse_identifier().id.into();
|
||||
let mut progress = ParserProgress::default();
|
||||
|
||||
while self.eat(TokenKind::Dot) {
|
||||
@@ -686,7 +688,7 @@ impl<'src> Parser<'src> {
|
||||
// import a.b.c
|
||||
// import a . b . c
|
||||
ast::Identifier {
|
||||
id: dotted_name,
|
||||
id: Name::from(dotted_name),
|
||||
range: self.node_range(start),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user