mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 23:57:54 +00:00
Use CompactString
for Identifier
(#12101)
This commit is contained in:
parent
db6ee74cbe
commit
5109b50bb3
474 changed files with 4953 additions and 4776 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue