From 2d09d69fbedc9ef5b600a732955f03641ca6f11b Mon Sep 17 00:00:00 2001 From: David Barsky Date: Thu, 8 Feb 2024 19:55:12 -0500 Subject: [PATCH] internal: fix crash inside `filter_unnecessary_bounds` for a missing generic param --- crates/ide-assists/src/handlers/generate_function.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ide-assists/src/handlers/generate_function.rs b/crates/ide-assists/src/handlers/generate_function.rs index 63a62abc21..1253bd8037 100644 --- a/crates/ide-assists/src/handlers/generate_function.rs +++ b/crates/ide-assists/src/handlers/generate_function.rs @@ -908,7 +908,7 @@ fn filter_unnecessary_bounds( } } - let starting_nodes = necessary_params.iter().map(|param| param_map[param]); + let starting_nodes = necessary_params.iter().flat_map(|param| param_map.get(param).copied()); let reachable = graph.compute_reachable_nodes(starting_nodes); // Not pretty, but effective. If only there were `Vec::retain_index()`...