diff options
author | veetaha <[email protected]> | 2020-05-09 00:24:51 +0100 |
---|---|---|
committer | veetaha <[email protected]> | 2020-05-09 00:27:44 +0100 |
commit | aca9aa8b7e7f363779aeba1dfc60397f46b9544d (patch) | |
tree | 07224e64d8aac5625093929075ff595a8fde56d5 | |
parent | 1acb556907027622a07189aefa627502f6500b5a (diff) |
Simplify
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 20 |
1 files changed, 9 insertions, 11 deletions
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<PathBuf>, config: Config, connection: Connection) | |||
96 | let mut world_state = { | 96 | let mut world_state = { |
97 | let workspaces = { | 97 | let workspaces = { |
98 | // FIXME: support dynamic workspace loading. | 98 | // FIXME: support dynamic workspace loading. |
99 | let mut visited = FxHashSet::default(); | 99 | let project_roots: FxHashSet<_> = ws_roots |
100 | let project_roots = ws_roots | ||
101 | .iter() | 100 | .iter() |
102 | .filter_map(|it| ra_project_model::ProjectRoot::discover(it).ok()) | 101 | .filter_map(|it| ra_project_model::ProjectRoot::discover(it).ok()) |
103 | .flatten() | 102 | .flatten() |
104 | .filter(|it| visited.insert(it.clone())) | 103 | .collect(); |
105 | .collect::<Vec<_>>(); | ||
106 | 104 | ||
107 | if project_roots.is_empty() && config.notifications.cargo_toml_not_found { | 105 | if project_roots.is_empty() && config.notifications.cargo_toml_not_found { |
108 | show_message( | 106 | show_message( |
109 | req::MessageType::Error, | 107 | req::MessageType::Error, |
110 | format!( | 108 | format!( |
111 | "rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}", | 109 | "rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}", |
112 | ws_roots.iter().format_with(", ", |it, f| f(&it.display())) | 110 | ws_roots.iter().format_with(", ", |it, f| f(&it.display())) |
113 | ), | 111 | ), |
114 | &connection.sender, | 112 | &connection.sender, |
115 | ); | 113 | ); |
116 | }; | 114 | }; |
117 | 115 | ||
118 | project_roots | 116 | project_roots |