mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
fewer monomorphisations
This commit is contained in:
parent
d9b4835625
commit
b7422bd1ab
@ -44,9 +44,9 @@ impl<N: AstNode> AstEditor<N> {
|
||||
fn insert_children(
|
||||
&self,
|
||||
position: InsertPosition<SyntaxElement>,
|
||||
to_insert: impl Iterator<Item = SyntaxElement>,
|
||||
mut to_insert: impl Iterator<Item = SyntaxElement>,
|
||||
) -> N {
|
||||
let new_syntax = insert_children(self.ast().syntax(), position, to_insert);
|
||||
let new_syntax = insert_children(self.ast().syntax(), position, &mut to_insert);
|
||||
N::cast(new_syntax).unwrap()
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ impl<N: AstNode> AstEditor<N> {
|
||||
fn replace_children(
|
||||
&self,
|
||||
to_delete: RangeInclusive<SyntaxElement>,
|
||||
to_insert: impl Iterator<Item = SyntaxElement>,
|
||||
mut to_insert: impl Iterator<Item = SyntaxElement>,
|
||||
) -> N {
|
||||
let new_syntax = replace_children(self.ast().syntax(), to_delete, to_insert);
|
||||
let new_syntax = replace_children(self.ast().syntax(), to_delete, &mut to_insert);
|
||||
N::cast(new_syntax).unwrap()
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ pub enum InsertPosition<T> {
|
||||
pub fn insert_children(
|
||||
parent: &SyntaxNode,
|
||||
position: InsertPosition<SyntaxElement>,
|
||||
to_insert: impl Iterator<Item = SyntaxElement>,
|
||||
to_insert: &mut dyn Iterator<Item = SyntaxElement>,
|
||||
) -> SyntaxNode {
|
||||
let mut delta = TextUnit::default();
|
||||
let to_insert = to_insert.map(|element| {
|
||||
@ -108,7 +108,7 @@ pub fn insert_children(
|
||||
pub fn replace_children(
|
||||
parent: &SyntaxNode,
|
||||
to_delete: RangeInclusive<SyntaxElement>,
|
||||
to_insert: impl Iterator<Item = SyntaxElement>,
|
||||
to_insert: &mut dyn Iterator<Item = SyntaxElement>,
|
||||
) -> SyntaxNode {
|
||||
let start = position_of_child(parent, to_delete.start().clone());
|
||||
let end = position_of_child(parent, to_delete.end().clone());
|
||||
|
Loading…
Reference in New Issue
Block a user