aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-08 12:47:40 +0100
committerGitHub <[email protected]>2021-05-08 12:47:40 +0100
commit526040eea8886a748dfd0a5449526f37a8bcf6af (patch)
tree8c8a73cee1b7333920f2b13fe7899f35b9bb1b91 /crates/syntax/src
parent4e3f0186d87e1be85bdc1e0bc3074147715e46c3 (diff)
parent1fdc9d8e9ee6afa62fe312e18aadaff316265bb8 (diff)
Merge #8765
8765: internal: remove one more syntax rewriter r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/syntax/src')
-rw-r--r--crates/syntax/src/ted.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/syntax/src/ted.rs b/crates/syntax/src/ted.rs
index 91a06101f..a50c0dbca 100644
--- a/crates/syntax/src/ted.rs
+++ b/crates/syntax/src/ted.rs
@@ -125,8 +125,11 @@ pub fn remove_all_iter(range: impl IntoIterator<Item = SyntaxElement>) {
125} 125}
126 126
127pub fn replace(old: impl Element, new: impl Element) { 127pub fn replace(old: impl Element, new: impl Element) {
128 replace_with_many(old, vec![new.syntax_element()])
129}
130pub fn replace_with_many(old: impl Element, new: Vec<SyntaxElement>) {
128 let old = old.syntax_element(); 131 let old = old.syntax_element();
129 replace_all(old.clone()..=old, vec![new.syntax_element()]) 132 replace_all(old.clone()..=old, new)
130} 133}
131pub fn replace_all(range: RangeInclusive<SyntaxElement>, new: Vec<SyntaxElement>) { 134pub fn replace_all(range: RangeInclusive<SyntaxElement>, new: Vec<SyntaxElement>) {
132 let start = range.start().index(); 135 let start = range.start().index();