diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs index 4d56668cf28c..e02891eca205 100644 --- a/crates/project-model/src/workspace.rs +++ b/crates/project-model/src/workspace.rs @@ -819,10 +819,16 @@ impl ProjectWorkspace { // [lib] // path = "../../src/lib.rs" // ``` + // + // or + // + // ```toml + // [[bin]] + // path = "../bin_folder/main.rs" + // ``` let extra_targets = cargo[pkg] .targets .iter() - .filter(|&&tgt| matches!(cargo[tgt].kind, TargetKind::Lib { .. })) .filter_map(|&tgt| cargo[tgt].root.parent()) .map(|tgt| tgt.normalize().to_path_buf()) .filter(|path| !path.starts_with(&pkg_root)); @@ -838,6 +844,8 @@ impl ProjectWorkspace { exclude.push(pkg_root.join("examples")); exclude.push(pkg_root.join("benches")); } + include.sort(); + include.dedup(); PackageRoot { is_local, include, exclude } }) .chain(mk_sysroot()) @@ -874,10 +882,16 @@ impl ProjectWorkspace { // [lib] // path = "../../src/lib.rs" // ``` + // + // or + // + // ```toml + // [[bin]] + // path = "../bin_folder/main.rs" + // ``` let extra_targets = cargo[pkg] .targets .iter() - .filter(|&&tgt| matches!(cargo[tgt].kind, TargetKind::Lib { .. })) .filter_map(|&tgt| cargo[tgt].root.parent()) .map(|tgt| tgt.normalize().to_path_buf()) .filter(|path| !path.starts_with(&pkg_root)); @@ -893,6 +907,8 @@ impl ProjectWorkspace { exclude.push(pkg_root.join("examples")); exclude.push(pkg_root.join("benches")); } + include.sort(); + include.dedup(); PackageRoot { is_local, include, exclude } }) }))