mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Simplify
This commit is contained in:
parent
1acb556907
commit
aca9aa8b7e
1 changed files with 9 additions and 11 deletions
|
@ -96,23 +96,21 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection)
|
||||||
let mut world_state = {
|
let mut world_state = {
|
||||||
let workspaces = {
|
let workspaces = {
|
||||||
// FIXME: support dynamic workspace loading.
|
// FIXME: support dynamic workspace loading.
|
||||||
let mut visited = FxHashSet::default();
|
let project_roots: FxHashSet<_> = ws_roots
|
||||||
let project_roots = ws_roots
|
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|it| ra_project_model::ProjectRoot::discover(it).ok())
|
.filter_map(|it| ra_project_model::ProjectRoot::discover(it).ok())
|
||||||
.flatten()
|
.flatten()
|
||||||
.filter(|it| visited.insert(it.clone()))
|
.collect();
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
if project_roots.is_empty() && config.notifications.cargo_toml_not_found {
|
if project_roots.is_empty() && config.notifications.cargo_toml_not_found {
|
||||||
show_message(
|
show_message(
|
||||||
req::MessageType::Error,
|
req::MessageType::Error,
|
||||||
format!(
|
format!(
|
||||||
"rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}",
|
"rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}",
|
||||||
ws_roots.iter().format_with(", ", |it, f| f(&it.display()))
|
ws_roots.iter().format_with(", ", |it, f| f(&it.display()))
|
||||||
),
|
),
|
||||||
&connection.sender,
|
&connection.sender,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
project_roots
|
project_roots
|
||||||
|
|
Loading…
Reference in a new issue