From: Ximin Luo Date: Wed, 14 Mar 2018 14:50:09 +0000 (+0100) Subject: Fix a bug in #5152 that causes rustc/rustdoc to fail unnecessarily X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~23^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3e07a3e66020fe56a570e211e469045faff31bfa;p=cargo.git Fix a bug in #5152 that causes rustc/rustdoc to fail unnecessarily --- diff --git a/src/bin/commands/rustc.rs b/src/bin/commands/rustc.rs index 268b835a6..b53e5a8ab 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 f3744cebf..1712b8559 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,