Use CompactString for Identifier (#12101)

This commit is contained in:
Micha Reiser 2024-07-01 10:06:02 +02:00 committed by GitHub
parent db6ee74cbe
commit 5109b50bb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
474 changed files with 4953 additions and 4776 deletions

View file

@ -7,7 +7,7 @@ use ruff_python_trivia::{indentation_at_offset, CommentRanges, SimpleTokenKind,
use ruff_source_file::Locator;
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
use crate::name::{QualifiedName, QualifiedNameBuilder};
use crate::name::{Name, QualifiedName, QualifiedNameBuilder};
use crate::parenthesize::parenthesized_range;
use crate::statement_visitor::StatementVisitor;
use crate::visitor::Visitor;
@ -1403,7 +1403,7 @@ pub fn pep_604_union(elts: &[Expr]) -> Expr {
}
/// Format the expression as a `typing.Optional`-style optional.
pub fn typing_optional(elt: Expr, binding: String) -> Expr {
pub fn typing_optional(elt: Expr, binding: Name) -> Expr {
Expr::Subscript(ast::ExprSubscript {
value: Box::new(Expr::Name(ast::ExprName {
id: binding,
@ -1417,8 +1417,8 @@ pub fn typing_optional(elt: Expr, binding: String) -> Expr {
}
/// Format the expressions as a `typing.Union`-style union.
pub fn typing_union(elts: &[Expr], binding: String) -> Expr {
fn tuple(elts: &[Expr], binding: String) -> Expr {
pub fn typing_union(elts: &[Expr], binding: Name) -> Expr {
fn tuple(elts: &[Expr], binding: Name) -> Expr {
match elts {
[] => Expr::Tuple(ast::ExprTuple {
elts: vec![],