We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8dd8c28 commit 3345cd6Copy full SHA for 3345cd6
crates/rust-analyzer/src/reload.rs
@@ -215,13 +215,17 @@ impl GlobalState {
215
let mut i = 0;
216
while i < workspaces.len() {
217
if let Ok(w) = &workspaces[i] {
218
- if let Some(dupe) = workspaces[i + 1..]
+ let dupes: Vec<_> = workspaces
219
.iter()
220
- .filter_map(|it| it.as_ref().ok())
221
- .position(|ws| ws.eq_ignore_build_data(w))
222
- {
223
- _ = workspaces.remove(dupe);
224
- }
+ .enumerate()
+ .skip(i + 1)
+ .filter_map(|(i, it)| {
+ it.as_ref().ok().filter(|ws| ws.eq_ignore_build_data(w)).map(|_| i)
+ })
225
+ .collect();
226
+ dupes.into_iter().rev().for_each(|d| {
227
+ _ = workspaces.remove(d);
228
+ });
229
}
230
i += 1;
231
0 commit comments