Skip to content

Commit 92e252b

Browse files
committed
refactor(cli): Allow --targets to fail
1 parent 801b223 commit 92e252b

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/bin/cargo/commands/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
2727
let opts = CleanOptions {
2828
config,
2929
spec: values(args, "package"),
30-
targets: args.targets(),
30+
targets: args.targets()?,
3131
requested_profile: args.get_profile_name(config, "dev", ProfileChecking::Custom)?,
3232
profile_specified: args.contains_id("profile") || args.flag("release"),
3333
doc: args.flag("doc"),

src/bin/cargo/commands/fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
1717

1818
let opts = FetchOptions {
1919
config,
20-
targets: args.targets(),
20+
targets: args.targets()?,
2121
};
2222
let _ = ops::fetch(&ws, &opts)?;
2323
Ok(())

src/bin/cargo/commands/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
5858
check_metadata: !args.flag("no-metadata"),
5959
allow_dirty: args.flag("allow-dirty"),
6060
to_package: specs,
61-
targets: args.targets(),
61+
targets: args.targets()?,
6262
jobs: args.jobs()?,
6363
keep_going: args.keep_going(),
6464
cli_features: args.cli_features()?,

src/bin/cargo/commands/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
5050
verify: !args.flag("no-verify"),
5151
allow_dirty: args.flag("allow-dirty"),
5252
to_publish: args.packages_from_flags()?,
53-
targets: args.targets(),
53+
targets: args.targets()?,
5454
jobs: args.jobs()?,
5555
keep_going: args.keep_going(),
5656
dry_run: args.dry_run(),

src/cargo/util/command_prelude.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ pub trait ArgMatchesExt {
440440
self.maybe_flag("keep-going")
441441
}
442442

443-
fn targets(&self) -> Vec<String> {
444-
self._values_of("target")
443+
fn targets(&self) -> CargoResult<Vec<String>> {
444+
Ok(self._values_of("target"))
445445
}
446446

447447
fn get_profile_name(
@@ -590,7 +590,7 @@ pub trait ArgMatchesExt {
590590
config,
591591
self.jobs()?,
592592
self.keep_going(),
593-
&self.targets(),
593+
&self.targets()?,
594594
mode,
595595
)?;
596596
build_config.message_format = message_format.unwrap_or(MessageFormat::Human);

0 commit comments

Comments
 (0)