internal: remove one more syntax rewriter

This commit is contained in:
Aleksey Kladov 2021-05-08 14:38:56 +03:00
parent 4e3f0186d8
commit 1fdc9d8e9e
3 changed files with 38 additions and 65 deletions

View file

@ -125,8 +125,11 @@ pub fn remove_all_iter(range: impl IntoIterator<Item = SyntaxElement>) {
}
pub fn replace(old: impl Element, new: impl Element) {
replace_with_many(old, vec![new.syntax_element()])
}
pub fn replace_with_many(old: impl Element, new: Vec<SyntaxElement>) {
let old = old.syntax_element();
replace_all(old.clone()..=old, vec![new.syntax_element()])
replace_all(old.clone()..=old, new)
}
pub fn replace_all(range: RangeInclusive<SyntaxElement>, new: Vec<SyntaxElement>) {
let start = range.start().index();