From 79e9ad0d479e882a1c782c39672951600a7c93ff Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Thu, 31 Oct 2024 03:12:24 +0100 Subject: [PATCH] Fix --package --workspace --- src/cargo/util/command_prelude.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 16e588cd480..54809949325 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -688,7 +688,14 @@ Run `{cmd}` to see possible targets." workspace: Option<&Workspace<'_>>, profile_checking: ProfileChecking, ) -> CargoResult { - let spec = self.packages_from_flags()?; + let w = self.flag("workspace"); + let mut all = w || self.flag("all"); + let package = self._values_of("package"); + if w && !package.is_empty() { + all = false; + } + + let spec = Packages::from_flags(all, self._values_of("exclude"), package)?; let mut message_format = None; let default_json = MessageFormat::Json { short: false,