diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index 2d1d08fba2..8c60927e4f 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs @@ -2,7 +2,7 @@ //! immutable, all function here return a fresh copy of the tree, instead of //! doing an in-place modification. use std::{ - fmt, iter, + array, fmt, iter, ops::{self, RangeInclusive}, }; @@ -55,9 +55,8 @@ impl ast::Fn { let anchor = self.name().expect("The function must have a name").syntax().clone(); - let mut to_insert: ArrayVec = ArrayVec::new(); - to_insert.push(generic_args.syntax().clone().into()); - self.insert_children(InsertPosition::After(anchor.into()), to_insert) + let to_insert = [generic_args.syntax().clone().into()]; + self.insert_children(InsertPosition::After(anchor.into()), array::IntoIter::new(to_insert)) } }