Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #22246 from Shourya742/2026-05-02-remove-add-predicate
Remove add predicate for Where syntax
Chayim Refael Friedman 2 weeks ago
parent ab19f48 · parent ba20168 · commit c25feec
-rw-r--r--crates/syntax/src/ast/edit_in_place.rs11
-rw-r--r--crates/syntax/src/ast/make.rs7
2 files changed, 1 insertions, 17 deletions
diff --git a/crates/syntax/src/ast/edit_in_place.rs b/crates/syntax/src/ast/edit_in_place.rs
index b490f72591..a893f65dc3 100644
--- a/crates/syntax/src/ast/edit_in_place.rs
+++ b/crates/syntax/src/ast/edit_in_place.rs
@@ -77,17 +77,6 @@ impl ast::GenericParamList {
}
}
-impl ast::WhereClause {
- pub fn add_predicate(&self, predicate: ast::WherePred) {
- if let Some(pred) = self.predicates().last()
- && !pred.syntax().siblings_with_tokens(Direction::Next).any(|it| it.kind() == T![,])
- {
- ted::append_child_raw(self.syntax(), make::token(T![,]));
- }
- ted::append_child(self.syntax(), predicate.syntax());
- }
-}
-
pub trait Removable: AstNode {
fn remove(&self);
}
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
index e8f5c9537d..718e5e2dca 100644
--- a/crates/syntax/src/ast/make.rs
+++ b/crates/syntax/src/ast/make.rs
@@ -294,12 +294,7 @@ fn merge_where_clause(
(None, None) => None,
(None, Some(bs)) => Some(bs),
(Some(ps), None) => Some(ps),
- (Some(ps), Some(bs)) => {
- let preds = where_clause(std::iter::empty()).clone_for_update();
- ps.predicates().for_each(|p| preds.add_predicate(p));
- bs.predicates().for_each(|p| preds.add_predicate(p));
- Some(preds)
- }
+ (Some(ps), Some(bs)) => Some(where_clause(ps.predicates().chain(bs.predicates()))),
}
}