Create a newtype wrapper around Vec<FStringElement> (#11400)

## Summary

This PR adds a newtype wrapper around `Vec<FStringElement>` that derefs
to a `&Vec<FStringElement>`.

Both f-string and format specifier are made up of `Vec<FStringElement>`.
By creating a newtype wrapper around it, we can share the methods for
both parent types.
This commit is contained in:
Dhruv Manilawala 2024-05-13 21:34:04 +05:30 committed by GitHub
parent 0dc130e841
commit 4b41e4de7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 71 additions and 39 deletions

View file

@ -739,7 +739,7 @@ pub fn walk_pattern_keyword<'a, V: Visitor<'a> + ?Sized>(
}
pub fn walk_f_string<'a, V: Visitor<'a> + ?Sized>(visitor: &mut V, f_string: &'a FString) {
for f_string_element in &f_string.elements {
for f_string_element in f_string.elements.iter() {
visitor.visit_f_string_element(f_string_element);
}
}
@ -756,7 +756,7 @@ pub fn walk_f_string_element<'a, V: Visitor<'a> + ?Sized>(
{
visitor.visit_expr(expression);
if let Some(format_spec) = format_spec {
for spec_element in &format_spec.elements {
for spec_element in format_spec.elements.iter() {
visitor.visit_f_string_element(spec_element);
}
}