mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 16:40:36 +00:00
Reduce Result<Tok, LexicalError>
size by using Box<str>
instead of String
(#9885)
This commit is contained in:
parent
9027169125
commit
fe7d965334
22 changed files with 454 additions and 425 deletions
|
@ -631,7 +631,7 @@ pub struct ComparableStringLiteral<'a> {
|
|||
impl<'a> From<&'a ast::StringLiteral> for ComparableStringLiteral<'a> {
|
||||
fn from(string_literal: &'a ast::StringLiteral) -> Self {
|
||||
Self {
|
||||
value: string_literal.value.as_str(),
|
||||
value: &string_literal.value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1089,10 +1089,7 @@ impl<'a> From<&'a ast::Expr> for ComparableExpr<'a> {
|
|||
kind,
|
||||
value,
|
||||
range: _,
|
||||
}) => Self::IpyEscapeCommand(ExprIpyEscapeCommand {
|
||||
kind: *kind,
|
||||
value: value.as_str(),
|
||||
}),
|
||||
}) => Self::IpyEscapeCommand(ExprIpyEscapeCommand { kind: *kind, value }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1537,10 +1534,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> {
|
|||
kind,
|
||||
value,
|
||||
range: _,
|
||||
}) => Self::IpyEscapeCommand(StmtIpyEscapeCommand {
|
||||
kind: *kind,
|
||||
value: value.as_str(),
|
||||
}),
|
||||
}) => Self::IpyEscapeCommand(StmtIpyEscapeCommand { kind: *kind, value }),
|
||||
ast::Stmt::Expr(ast::StmtExpr { value, range: _ }) => Self::Expr(StmtExpr {
|
||||
value: value.into(),
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue