From c2cf34db90e48de6e8a10da7959a4c49f95e1ff6 Mon Sep 17 00:00:00 2001 From: m5tfi <72708423+m5tfi@users.noreply.github.com> Date: Wed, 5 May 2021 06:27:16 +0200 Subject: remove unneeded `visited_where_clauses` --- crates/ide/src/folding_ranges.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) mode change 100644 => 100755 crates/ide/src/folding_ranges.rs (limited to 'crates') diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs old mode 100644 new mode 100755 index e03ddaa14..a03988778 --- 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)); } } -- cgit v1.2.3