mirror of https://github.com/astral-sh/ruff
Update `FStringElements` to deref to a slice (#11570)
Ref: https://github.com/astral-sh/ruff/pull/11400#discussion_r1615600354
This commit is contained in:
parent
37ad994318
commit
e28e737296
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
@ -1348,7 +1348,7 @@ impl<'src> Parser<'src> {
|
|||
elements.push(element);
|
||||
});
|
||||
|
||||
elements
|
||||
FStringElements::from(elements)
|
||||
}
|
||||
|
||||
/// Parses a f-string expression element.
|
||||
|
|
|
|||
Loading…
Reference in New Issue