From aca9aa8b7e7f363779aeba1dfc60397f46b9544d Mon Sep 17 00:00:00 2001 From: veetaha Date: Sat, 9 May 2020 02:24:51 +0300 Subject: Simplify --- crates/rust-analyzer/src/main_loop.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index b77f0c5a9..17b0b95b9 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -96,23 +96,21 @@ pub fn main_loop(ws_roots: Vec, config: Config, connection: Connection) let mut world_state = { let workspaces = { // FIXME: support dynamic workspace loading. - let mut visited = FxHashSet::default(); - let project_roots = ws_roots + let project_roots: FxHashSet<_> = ws_roots .iter() .filter_map(|it| ra_project_model::ProjectRoot::discover(it).ok()) .flatten() - .filter(|it| visited.insert(it.clone())) - .collect::>(); + .collect(); if project_roots.is_empty() && config.notifications.cargo_toml_not_found { show_message( - req::MessageType::Error, - format!( - "rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}", - ws_roots.iter().format_with(", ", |it, f| f(&it.display())) - ), - &connection.sender, - ); + req::MessageType::Error, + format!( + "rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}", + ws_roots.iter().format_with(", ", |it, f| f(&it.display())) + ), + &connection.sender, + ); }; project_roots -- cgit v1.2.3