diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs old mode 100644 new mode 100755 index e03ddaa14f..a039887783 --- a/crates/ide/src/folding_ranges.rs +++ b/crates/ide/src/folding_ranges.rs @@ -36,7 +36,6 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec { let mut visited_mods = FxHashSet::default(); let mut visited_consts = FxHashSet::default(); let mut visited_statics = FxHashSet::default(); - let mut visited_where_clauses = FxHashSet::default(); // regions can be nested, here is a LIFO buffer let mut regions_starts: Vec = vec![]; @@ -113,10 +112,8 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec { } // Fold where clause - if node.kind() == WHERE_CLAUSE && !visited_where_clauses.contains(&node) { - if let Some(range) = - contiguous_range_for_where(&node, &mut visited_where_clauses) - { + if node.kind() == WHERE_CLAUSE { + if let Some(range) = fold_range_for_where_clause(&node) { res.push(Fold { range, kind: FoldKind::WhereClause }) } } @@ -252,10 +249,7 @@ fn contiguous_range_for_comment( } } -fn contiguous_range_for_where( - node: &SyntaxNode, - visited: &mut FxHashSet, -) -> Option { +fn fold_range_for_where_clause(node: &SyntaxNode) -> Option { let first_where_pred = node.first_child(); let last_where_pred = node.last_child(); @@ -266,8 +260,6 @@ fn contiguous_range_for_where( { let start = where_kw.text_range().end(); let end = last_comma.text_range().end(); - - visited.insert(node.clone()); return Some(TextRange::new(start, end)); } }