mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-26 13:24:23 +00:00
Add as_slice
method for all string nodes (#9111)
This PR adds a `as_slice` method to all the string nodes which returns all the parts of the nodes as a slice. This will be useful in the next PR to split the string formatting to use this method to extract the _single node_ or _implicitly concanated nodes_.
This commit is contained in:
parent
cb99815c3e
commit
18452cf477
13 changed files with 121 additions and 65 deletions
|
@ -1326,7 +1326,7 @@ impl Truthiness {
|
|||
Expr::NoneLiteral(_) => Self::Falsey,
|
||||
Expr::EllipsisLiteral(_) => Self::Truthy,
|
||||
Expr::FString(ast::ExprFString { value, .. }) => {
|
||||
if value.parts().all(|part| match part {
|
||||
if value.iter().all(|part| match part {
|
||||
ast::FStringPart::Literal(string_literal) => string_literal.is_empty(),
|
||||
ast::FStringPart::FString(f_string) => f_string.elements.is_empty(),
|
||||
}) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue