Skip to content

Commit aca9aa8

Browse files
committed
Simplify
1 parent 1acb556 commit aca9aa8

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

crates/rust-analyzer/src/main_loop.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,21 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection)
9696
let mut world_state = {
9797
let workspaces = {
9898
// FIXME: support dynamic workspace loading.
99-
let mut visited = FxHashSet::default();
100-
let project_roots = ws_roots
99+
let project_roots: FxHashSet<_> = ws_roots
101100
.iter()
102101
.filter_map(|it| ra_project_model::ProjectRoot::discover(it).ok())
103102
.flatten()
104-
.filter(|it| visited.insert(it.clone()))
105-
.collect::<Vec<_>>();
103+
.collect();
106104

107105
if project_roots.is_empty() && config.notifications.cargo_toml_not_found {
108106
show_message(
109-
req::MessageType::Error,
110-
format!(
111-
"rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}",
112-
ws_roots.iter().format_with(", ", |it, f| f(&it.display()))
113-
),
114-
&connection.sender,
115-
);
107+
req::MessageType::Error,
108+
format!(
109+
"rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: {}",
110+
ws_roots.iter().format_with(", ", |it, f| f(&it.display()))
111+
),
112+
&connection.sender,
113+
);
116114
};
117115

118116
project_roots

0 commit comments

Comments
 (0)