diff --git a/src/bin/commands/rustc.rs b/src/bin/commands/rustc.rs index 268b835a630..b53e5a8abd1 100644 --- a/src/bin/commands/rustc.rs +++ b/src/bin/commands/rustc.rs @@ -62,7 +62,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { } }; let mut compile_opts = args.compile_options_for_single_package(config, mode)?; - compile_opts.target_rustc_args = Some(values(args, "args")); + let target_args = values(args, "args"); + compile_opts.target_rustc_args = if target_args.is_empty() { + None + } else { + Some(target_args) + }; ops::compile(&ws, &compile_opts)?; Ok(()) } diff --git a/src/bin/commands/rustdoc.rs b/src/bin/commands/rustdoc.rs index f3744cebf16..1712b855992 100644 --- a/src/bin/commands/rustdoc.rs +++ b/src/bin/commands/rustdoc.rs @@ -49,7 +49,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { let ws = args.workspace(config)?; let mut compile_opts = args.compile_options_for_single_package(config, CompileMode::Doc { deps: false })?; - compile_opts.target_rustdoc_args = Some(values(args, "args")); + let target_args = values(args, "args"); + compile_opts.target_rustdoc_args = if target_args.is_empty() { + None + } else { + Some(target_args) + }; let doc_opts = DocOptions { open_result: args.is_present("open"), compile_opts,