| 1 | //! Cargo flags for selecting crates in a workspace. |
| 2 | |
| 3 | /// Cargo flags for selecting crates in a workspace. |
| 4 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 5 | #[cfg_attr(feature = "clap", derive(claprust-analyzer cargo clap 4.5.48 crate/::Argsrust-analyzer cargo clap_derive 4.5.47 Args:))] |
| 6 | #[cfg_attr(feature = "clap", command(about = None, long_about = None))] |
| 7 | #[non_exhaustive] |
| 8 | pub struct Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 9 | #[cfg_attr(feature = "clap", arg(short, long, value_name = "SPEC"))] |
| 10 | /// Package to process (see `cargo help pkgid`) |
| 11 | pub packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 12 | #[cfg_attr(feature = "clap", arg(long))] |
| 13 | /// Process all packages in the workspace |
| 14 | pub workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#workspace.: bool, |
| 15 | #[cfg_attr(feature = "clap", arg(long, hide = true))] |
| 16 | /// Process all packages in the workspace |
| 17 | pub allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: bool, |
| 18 | #[cfg_attr(feature = "clap", arg(long, value_name = "SPEC"))] |
| 19 | /// Exclude packages from being processed |
| 20 | pub excluderust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#exclude.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 21 | } |
| 22 | |
| 23 | #[cfg(feature = "cargo_metadata")] |
| 24 | impl Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 25 | /// Partition workspace members into those selected and those excluded. |
| 26 | /// |
| 27 | /// Notes: |
| 28 | /// - Requires the features `cargo_metadata`. |
| 29 | /// - Requires not calling `MetadataCommand::no_deps` |
| 30 | pub fn partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().<'m>( |
| 31 | &self, |
| 32 | meta: &'m cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::Metadatarust-analyzer cargo cargo_metadata 0.23.0 Metadata#, |
| 33 | ) -> ( |
| 34 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'m cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::Packagerust-analyzer cargo cargo_metadata 0.23.0 Package#>, |
| 35 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'m cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::Packagerust-analyzer cargo cargo_metadata 0.23.0 Package#>, |
| 36 | ) { |
| 37 | let selection = |
| 38 | Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::from_flagsrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[`Packages<'p>`]from_flags().(self.workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#workspace. || self.allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all., &self.excluderust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#exclude., &self.packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.); |
| 39 | let workspace_members: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<_> = |
| 40 | meta.workspace_membersrust-analyzer cargo cargo_metadata 0.23.0 Metadata#workspace_members..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 41 | let workspace_default_members: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<_> = |
| 42 | meta.workspace_default_membersrust-analyzer cargo cargo_metadata 0.23.0 Metadata#workspace_default_members..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 43 | let base_ids: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<_> = match selection { |
| 44 | Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Default# => workspace_default_members, |
| 45 | Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Allrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#All# => workspace_members, |
| 46 | Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::OptOutrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#OptOut#(_) => workspace_members, // Deviating from cargo by only checking workspace members |
| 47 | Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Packages#(patterns) => { |
| 48 | meta.packagesrust-analyzer cargo cargo_metadata 0.23.0 Metadata#packages. |
| 49 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 50 | // Deviating from cargo by not supporting patterns |
| 51 | // Deviating from cargo by only checking workspace members |
| 52 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|p| workspace_members.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&p.idrust-analyzer cargo cargo_metadata 0.23.0 Package#id.) && patterns.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&p.namerust-analyzer cargo cargo_metadata 0.23.0 Package#name.)) |
| 53 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|p| &p.idrust-analyzer cargo cargo_metadata 0.23.0 Package#id.) |
| 54 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 55 | } |
| 56 | }; |
| 57 | |
| 58 | meta.packagesrust-analyzer cargo cargo_metadata 0.23.0 Metadata#packages. |
| 59 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 60 | // Deviating from cargo by not supporting patterns |
| 61 | .partitionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#partition().(|p| base_ids.containsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]contains().(&p.idrust-analyzer cargo cargo_metadata 0.23.0 Package#id.) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.excluderust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#exclude..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&p.namerust-analyzer cargo cargo_metadata 0.23.0 Package#name.)) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // See cargo's src/cargo/ops/cargo_compile.rs |
| 66 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 67 | #[cfg(feature = "cargo_metadata")] |
| 68 | #[allow(clippy::enum_variant_names)] |
| 69 | enum Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#<'p> { |
| 70 | Defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Default#, |
| 71 | Allrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#All#, |
| 72 | OptOutrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#OptOut#(&'p [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#]), |
| 73 | Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Packages#(&'p [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#]), |
| 74 | } |
| 75 | |
| 76 | #[cfg(feature = "cargo_metadata")] |
| 77 | impl<'p> Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#<'p> { |
| 78 | fn from_flagsrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[`Packages<'p>`]from_flags().(all: bool, exclude: &'p [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#], package: &'p [Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#]) -> Selfrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[`Packages<'p>`] { |
| 79 | match (all, exclude.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().(), package.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()) { |
| 80 | (false, 0, 0) => Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Default#, |
| 81 | (false, 0, _) => Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Packages#(package), |
| 82 | (false, _, 0) => Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::OptOutrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#OptOut#(exclude), // Deviating from cargo because we don't do error handling |
| 83 | (false, _, _) => Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#Packages#(package), // Deviating from cargo because we don't do error handling |
| 84 | (true, 0, _) => Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::Allrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#All#, |
| 85 | (true, _, _) => Packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#::OptOutrust-analyzer cargo clap-cargo 0.18.3 workspace/Packages#OptOut#(exclude), |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | #[cfg(test)] |
| 91 | mod testrust-analyzer cargo clap-cargo 0.18.3 workspace/test/ { |
| 92 | use superrust-analyzer cargo clap-cargo 0.18.3 workspace/::*; |
| 93 | |
| 94 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 95 | #[cfg(feature = "clap")] |
| 96 | fn verify_apprust-analyzer cargo clap-cargo 0.18.3 workspace/test/verify_app().() { |
| 97 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, claprust-analyzer cargo clap 4.5.48 crate/::Parserrust-analyzer cargo clap_derive 4.5.47 Parser:)] |
| 98 | struct Clirust-analyzer cargo clap-cargo 0.18.3 workspace/test/Cli# { |
| 99 | #[commandrust-analyzer cargo clap_derive 4.5.47 command:(flatten)] |
| 100 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/test/Cli#workspace.: Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#, |
| 101 | } |
| 102 | |
| 103 | use claprust-analyzer cargo clap 4.5.48 crate/::CommandFactoryrust-analyzer cargo clap_builder 4.5.48 derive/CommandFactory#; |
| 104 | Clirust-analyzer cargo clap-cargo 0.18.3 workspace/test/Cli#::commandrust-analyzer cargo clap-cargo 0.18.3 workspace/test/impl#[Cli][CommandFactory]command().().debug_assertrust-analyzer cargo clap_builder 4.5.48 builder/command/impl#[Command]debug_assert().(); |
| 105 | } |
| 106 | |
| 107 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 108 | #[cfg(feature = "clap")] |
| 109 | fn parse_multiple_occurrencesrust-analyzer cargo clap-cargo 0.18.3 workspace/test/parse_multiple_occurrences().() { |
| 110 | use claprust-analyzer cargo clap 4.5.48 crate/::Parserrust-analyzer cargo clap_builder 4.5.48 derive/Parser#; |
| 111 | |
| 112 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Parserrust-analyzer cargo clap_derive 4.5.47 Parser:)] |
| 113 | struct Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args# { |
| 114 | positionalrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#positional.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 115 | #[commandrust-analyzer cargo clap_derive 4.5.47 command:(flatten)] |
| 116 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#workspace.: Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#, |
| 117 | } |
| 118 | |
| 119 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 120 | Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args# { |
| 121 | positionalrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#positional.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 122 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#workspace.: Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 123 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 124 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#workspace.: false, |
| 125 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: false, |
| 126 | excluderust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#exclude.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 127 | } |
| 128 | }, |
| 129 | Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#::parse_fromrust-analyzer cargo clap_builder 4.5.48 derive/Parser#parse_from().(["test"]) |
| 130 | ); |
| 131 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 132 | Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args# { |
| 133 | positionalrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#positional.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("baz".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()), |
| 134 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#workspace.: Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 135 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["foo".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), "bar".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 136 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#workspace.: false, |
| 137 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: false, |
| 138 | excluderust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#exclude.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 139 | } |
| 140 | }, |
| 141 | Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#::parse_fromrust-analyzer cargo clap_builder 4.5.48 derive/Parser#parse_from().(["test", "--package", "foo", "--package", "bar", "baz"]) |
| 142 | ); |
| 143 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 144 | Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args# { |
| 145 | positionalrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#positional.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("baz".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()), |
| 146 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#workspace.: Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 147 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 148 | workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#workspace.: false, |
| 149 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: false, |
| 150 | excluderust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#exclude.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["foo".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), "bar".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 151 | } |
| 152 | }, |
| 153 | Argsrust-analyzer cargo clap-cargo 0.18.3 workspace/test/Args#::parse_fromrust-analyzer cargo clap_builder 4.5.48 derive/Parser#parse_from().(["test", "--exclude", "foo", "--exclude", "bar", "baz"]) |
| 154 | ); |
| 155 | } |
| 156 | |
| 157 | #[cfg(feature = "cargo_metadata")] |
| 158 | #[cfg(test)] |
| 159 | mod partition_defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_default/ { |
| 160 | use superrust-analyzer cargo clap-cargo 0.18.3 workspace/test/::*; |
| 161 | |
| 162 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 163 | fn single_craterust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_default/single_crate().() { |
| 164 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 165 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/simple/Cargo.toml"); |
| 166 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 167 | |
| 168 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 169 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 170 | }; |
| 171 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 172 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 173 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 174 | } |
| 175 | |
| 176 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 177 | fn mixed_ws_rootrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_default/mixed_ws_root().() { |
| 178 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 179 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/mixed_ws/Cargo.toml"); |
| 180 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 181 | |
| 182 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 183 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 184 | }; |
| 185 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 186 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 187 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 188 | } |
| 189 | |
| 190 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 191 | fn mixed_ws_leafrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_default/mixed_ws_leaf().() { |
| 192 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 193 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/mixed_ws/c/Cargo.toml"); |
| 194 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 195 | |
| 196 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 197 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 198 | }; |
| 199 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 200 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 201 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 202 | } |
| 203 | |
| 204 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 205 | fn pure_ws_rootrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_default/pure_ws_root().() { |
| 206 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 207 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/pure_ws/Cargo.toml"); |
| 208 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 209 | |
| 210 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 211 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 212 | }; |
| 213 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 214 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 215 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 216 | } |
| 217 | |
| 218 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 219 | fn pure_ws_leafrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_default/pure_ws_leaf().() { |
| 220 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 221 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/pure_ws/c/Cargo.toml"); |
| 222 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 223 | |
| 224 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 225 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 226 | }; |
| 227 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 228 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 229 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | #[cfg(feature = "cargo_metadata")] |
| 234 | #[cfg(test)] |
| 235 | mod partition_allrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_all/ { |
| 236 | use superrust-analyzer cargo clap-cargo 0.18.3 workspace/test/::*; |
| 237 | |
| 238 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 239 | fn single_craterust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_all/single_crate().() { |
| 240 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 241 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/simple/Cargo.toml"); |
| 242 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 243 | |
| 244 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 245 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: true, |
| 246 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 247 | }; |
| 248 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 249 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 250 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 251 | } |
| 252 | |
| 253 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 254 | fn mixed_ws_rootrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_all/mixed_ws_root().() { |
| 255 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 256 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/mixed_ws/Cargo.toml"); |
| 257 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 258 | |
| 259 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 260 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: true, |
| 261 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 262 | }; |
| 263 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 264 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 265 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 266 | } |
| 267 | |
| 268 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 269 | fn mixed_ws_leafrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_all/mixed_ws_leaf().() { |
| 270 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 271 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/mixed_ws/c/Cargo.toml"); |
| 272 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 273 | |
| 274 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 275 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: true, |
| 276 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 277 | }; |
| 278 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 279 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 280 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 281 | } |
| 282 | |
| 283 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 284 | fn pure_ws_rootrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_all/pure_ws_root().() { |
| 285 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 286 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/pure_ws/Cargo.toml"); |
| 287 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 288 | |
| 289 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 290 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: true, |
| 291 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 292 | }; |
| 293 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 294 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 295 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 296 | } |
| 297 | |
| 298 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 299 | fn pure_ws_leafrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_all/pure_ws_leaf().() { |
| 300 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 301 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/pure_ws/c/Cargo.toml"); |
| 302 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 303 | |
| 304 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 305 | allrust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#all.: true, |
| 306 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 307 | }; |
| 308 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 309 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3); |
| 310 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | #[cfg(feature = "cargo_metadata")] |
| 315 | #[cfg(test)] |
| 316 | mod partition_packagerust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_package/ { |
| 317 | use superrust-analyzer cargo clap-cargo 0.18.3 workspace/test/::*; |
| 318 | |
| 319 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 320 | fn single_craterust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_package/single_crate().() { |
| 321 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 322 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/simple/Cargo.toml"); |
| 323 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 324 | |
| 325 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 326 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["simple".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 327 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 328 | }; |
| 329 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 330 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 331 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0); |
| 332 | } |
| 333 | |
| 334 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 335 | fn mixed_ws_rootrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_package/mixed_ws_root().() { |
| 336 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 337 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/mixed_ws/Cargo.toml"); |
| 338 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 339 | |
| 340 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 341 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 342 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 343 | }; |
| 344 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 345 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 346 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 347 | } |
| 348 | |
| 349 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 350 | fn mixed_ws_leafrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_package/mixed_ws_leaf().() { |
| 351 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 352 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/mixed_ws/c/Cargo.toml"); |
| 353 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 354 | |
| 355 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 356 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 357 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 358 | }; |
| 359 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 360 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 361 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 362 | } |
| 363 | |
| 364 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 365 | fn pure_ws_rootrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_package/pure_ws_root().() { |
| 366 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 367 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/pure_ws/Cargo.toml"); |
| 368 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 369 | |
| 370 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 371 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 372 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 373 | }; |
| 374 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 375 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 376 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 377 | } |
| 378 | |
| 379 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 380 | fn pure_ws_leafrust-analyzer cargo clap-cargo 0.18.3 workspace/test/partition_package/pure_ws_leaf().() { |
| 381 | let mut metadata = cargo_metadatarust-analyzer cargo cargo_metadata 0.23.0 crate/::MetadataCommandrust-analyzer cargo cargo_metadata 0.23.0 MetadataCommand#::newrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]new().(); |
| 382 | metadata.manifest_pathrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]manifest_path().("tests/fixtures/pure_ws/c/Cargo.toml"); |
| 383 | let metadata = metadata.execrust-analyzer cargo cargo_metadata 0.23.0 impl#[MetadataCommand]exec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 384 | |
| 385 | let workspace = Workspacerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace# { |
| 386 | packagerust-analyzer cargo clap-cargo 0.18.3 workspace/Workspace#package.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().()], |
| 387 | ..Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace][Default]default().() |
| 388 | }; |
| 389 | let (included, excluded) = workspace.partition_packagesrust-analyzer cargo clap-cargo 0.18.3 workspace/impl#[Workspace]partition_packages().(&metadata); |
| 390 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(included.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1); |
| 391 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(excluded.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2); |
| 392 | } |
| 393 | } |
| 394 | } |