Use crate root to choose relevant workspace for flycheck

This commit is contained in:
Wilfred Hughes 2024-03-27 10:33:20 -07:00
parent 4b33850c39
commit 5e370b1cb8
2 changed files with 4 additions and 5 deletions

View file

@ -74,7 +74,7 @@ pub struct ProjectJson {
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Crate {
pub(crate) display_name: Option<CrateDisplayName>,
pub(crate) root_module: AbsPathBuf,
pub root_module: AbsPathBuf,
pub(crate) edition: Edition,
pub(crate) version: Option<String>,
pub(crate) deps: Vec<Dependency>,

View file

@ -296,10 +296,9 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
})
}
project_model::ProjectWorkspace::Json { project, .. } => {
if !project
.crates()
.any(|(c, _)| crate_ids.iter().any(|&crate_id| crate_id == c))
{
if !project.crates().any(|(_, krate)| {
crate_root_paths.contains(&krate.root_module.as_path())
}) {
return None;
}
None