aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/main_loop.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-05-09 09:42:24 +0100
committerGitHub <[email protected]>2020-05-09 09:42:24 +0100
commitd7a0b0ff913d717fa6e7c5a1db02a30316760a75 (patch)
treeaa363cb56e41042da6db6712834910c2db771505 /crates/rust-analyzer/src/main_loop.rs
parent1acb556907027622a07189aefa627502f6500b5a (diff)
parente83a2912b8deaab560d1ea39232c06a29530d6e5 (diff)
Merge #4381
4381: Simplify r=matklad a=Veetaha Co-authored-by: veetaha <[email protected]>
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-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