Skip to content

Commit 9bb0281

Browse files
committed
Simplify
1 parent 1ce8c2b commit 9bb0281

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

crates/rust-analyzer/src/global_state.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,16 @@ use rustc_hash::{FxHashMap, FxHashSet};
3333

3434
fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option<Flycheck> {
3535
// FIXME: Figure out the multi-workspace situation
36-
workspaces
37-
.iter()
38-
.find_map(|w| match w {
39-
ProjectWorkspace::Cargo { cargo, .. } => Some(cargo),
40-
ProjectWorkspace::Json { .. } => None,
41-
})
42-
.map(|cargo| {
36+
workspaces.iter().find_map(|w| match w {
37+
ProjectWorkspace::Cargo { cargo, .. } => {
4338
let cargo_project_root = cargo.workspace_root().to_path_buf();
4439
Some(Flycheck::new(config.clone(), cargo_project_root))
45-
})
46-
.unwrap_or_else(|| {
40+
}
41+
ProjectWorkspace::Json { .. } => {
4742
log::warn!("Cargo check watching only supported for cargo workspaces, disabling");
4843
None
49-
})
44+
}
45+
})
5046
}
5147

5248
/// `GlobalState` is the primary mutable state of the language server

0 commit comments

Comments
 (0)