aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-05-09 00:24:51 +0100
committerveetaha <[email protected]>2020-05-09 00:27:44 +0100
commitaca9aa8b7e7f363779aeba1dfc60397f46b9544d (patch)
tree07224e64d8aac5625093929075ff595a8fde56d5 /crates
parent1acb556907027622a07189aefa627502f6500b5a (diff)
Simplify
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/main_loop.rs20
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