From 15fc643e05bf8273e378243edbfb3be7aea7ce11 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 10 Jan 2020 18:26:18 +0100 Subject: Fix ordering problem between qualifying paths and substituting params --- crates/ra_syntax/src/algo.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_syntax/src/algo.rs') diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs index 2b2b295f9..30a479f01 100644 --- a/crates/ra_syntax/src/algo.rs +++ b/crates/ra_syntax/src/algo.rs @@ -184,17 +184,17 @@ pub fn replace_children( /// to create a type-safe abstraction on top of it instead. pub fn replace_descendants( parent: &SyntaxNode, - map: &FxHashMap, + map: &impl Fn(&SyntaxElement) -> Option, ) -> SyntaxNode { // FIXME: this could be made much faster. let new_children = parent.children_with_tokens().map(|it| go(map, it)).collect::>(); return with_children(parent, new_children); fn go( - map: &FxHashMap, + map: &impl Fn(&SyntaxElement) -> Option, element: SyntaxElement, ) -> NodeOrToken { - if let Some(replacement) = map.get(&element) { + if let Some(replacement) = map(&element) { return match replacement { NodeOrToken::Node(it) => NodeOrToken::Node(it.green().clone()), NodeOrToken::Token(it) => NodeOrToken::Token(it.green().clone()), -- cgit v1.2.3