Skip to content

Commit

Permalink
replace !Vec::is_empty() then Some with bool::then()
Browse files Browse the repository at this point in the history
  • Loading branch information
srtnnm committed Sep 8, 2024
1 parent 1149535 commit 3a8eb54
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/bin/cargo/commands/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,15 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
compile_opts.build_config.requested_profile = InternedString::new("dev");
}
let target_args = values(args, "args");
compile_opts.target_rustc_args = if target_args.is_empty() {
None
} else {
Some(target_args)
};
compile_opts.target_rustc_args = (!target_args.is_empty()).then(|| target_args);
if let Some(opt_value) = args.get_one::<String>(PRINT_ARG_NAME) {
gctx.cli_unstable()
.fail_if_stable_opt(PRINT_ARG_NAME, 9357)?;
ops::print(&ws, &compile_opts, opt_value)?;
return Ok(());
}
let crate_types = values(args, CRATE_TYPE_ARG_NAME);
compile_opts.target_rustc_crate_types = if crate_types.is_empty() {
None
} else {
Some(crate_types)
};
compile_opts.target_rustc_crate_types = (!crate_types.is_empty()).then(|| crate_types);
ops::compile(&ws, &compile_opts)?;

Ok(())
Expand Down

0 comments on commit 3a8eb54

Please sign in to comment.