Skip to content

Commit

Permalink
Update FStringElements to deref to a slice (#11570)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmanila committed May 27, 2024
1 parent 37ad994 commit e28e737
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/ruff_python_ast/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ impl<'a> IntoIterator for &'a mut FStringElements {
}

impl Deref for FStringElements {
type Target = Vec<FStringElement>;
type Target = [FStringElement];

fn deref(&self) -> &Self::Target {
&self.0
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff_python_parser/src/parser/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ impl<'src> Parser<'src> {
///
/// If the parser isn't positioned at a `{` or `FStringMiddle` token.
fn parse_fstring_elements(&mut self) -> FStringElements {
let mut elements = FStringElements::default();
let mut elements = vec![];

self.parse_list(RecoveryContextKind::FStringElements, |parser| {
let element = match parser.current_token_kind() {
Expand Down Expand Up @@ -1348,7 +1348,7 @@ impl<'src> Parser<'src> {
elements.push(element);
});

elements
FStringElements::from(elements)
}

/// Parses a f-string expression element.
Expand Down

0 comments on commit e28e737

Please sign in to comment.