Skip to content

Commit 0195423

Browse files
committed
Remove unused CompileOptions.local_rustdoc_args
1 parent 3fd7580 commit 0195423

File tree

3 files changed

+18
-31
lines changed

3 files changed

+18
-31
lines changed

src/cargo/ops/cargo_compile.rs

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ pub struct CompileOptions {
8686
pub target_rustc_args: Option<Vec<String>>,
8787
/// Crate types to be passed to rustc (single target only)
8888
pub target_rustc_crate_types: Option<Vec<String>>,
89-
/// Extra arguments passed to all selected targets for rustdoc.
90-
pub local_rustdoc_args: Option<Vec<String>>,
9189
/// Whether the `--document-private-items` flags was specified and should
9290
/// be forwarded to `rustdoc`.
9391
pub rustdoc_document_private_items: bool,
@@ -110,7 +108,6 @@ impl CompileOptions {
110108
target_rustdoc_args: None,
111109
target_rustc_args: None,
112110
target_rustc_crate_types: None,
113-
local_rustdoc_args: None,
114111
rustdoc_document_private_items: false,
115112
honor_rust_version: true,
116113
})
@@ -206,7 +203,6 @@ pub fn create_bcx<'a, 'cfg>(
206203
ref target_rustdoc_args,
207204
ref target_rustc_args,
208205
ref target_rustc_crate_types,
209-
ref local_rustdoc_args,
210206
rustdoc_document_private_items,
211207
honor_rust_version,
212208
} = *options;
@@ -481,32 +477,25 @@ pub fn create_bcx<'a, 'cfg>(
481477
extra_compiler_args.insert(units[0].clone(), args);
482478
}
483479

484-
for unit in &units {
485-
if unit.mode.is_doc() || unit.mode.is_doc_test() {
486-
let mut extra_args = local_rustdoc_args.clone();
487-
488-
// Add `--document-private-items` rustdoc flag if requested or if
489-
// the target is a binary. Binary crates get their private items
490-
// documented by default.
491-
if rustdoc_document_private_items || unit.target.is_bin() {
492-
let mut args = extra_args.take().unwrap_or_default();
493-
args.push("--document-private-items".into());
494-
if unit.target.is_bin() {
495-
// This warning only makes sense if it's possible to document private items
496-
// sometimes and ignore them at other times. But cargo consistently passes
497-
// `--document-private-items`, so the warning isn't useful.
498-
args.push("-Arustdoc::private-intra-doc-links".into());
499-
}
500-
extra_args = Some(args);
501-
}
502-
503-
if let Some(args) = extra_args {
504-
extra_compiler_args
505-
.entry(unit.clone())
506-
.or_default()
507-
.extend(args);
508-
}
480+
for unit in units
481+
.iter()
482+
.filter(|unit| unit.mode.is_doc() || unit.mode.is_doc_test())
483+
.filter(|unit| rustdoc_document_private_items || unit.target.is_bin())
484+
{
485+
// Add `--document-private-items` rustdoc flag if requested or if
486+
// the target is a binary. Binary crates get their private items
487+
// documented by default.
488+
let mut args = vec!["--document-private-items".into()];
489+
if unit.target.is_bin() {
490+
// This warning only makes sense if it's possible to document private items
491+
// sometimes and ignore them at other times. But cargo consistently passes
492+
// `--document-private-items`, so the warning isn't useful.
493+
args.push("-Arustdoc::private-intra-doc-links".into());
509494
}
495+
extra_compiler_args
496+
.entry(unit.clone())
497+
.or_default()
498+
.extend(args);
510499
}
511500

512501
if honor_rust_version {

src/cargo/ops/cargo_package.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,6 @@ fn run_verify(
829829
target_rustdoc_args: None,
830830
target_rustc_args: rustc_args,
831831
target_rustc_crate_types: None,
832-
local_rustdoc_args: None,
833832
rustdoc_document_private_items: false,
834833
honor_rust_version: true,
835834
},

src/cargo/util/command_prelude.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,6 @@ pub trait ArgMatchesExt {
600600
target_rustdoc_args: None,
601601
target_rustc_args: None,
602602
target_rustc_crate_types: None,
603-
local_rustdoc_args: None,
604603
rustdoc_document_private_items: false,
605604
honor_rust_version: !self.flag("ignore-rust-version"),
606605
};

0 commit comments

Comments
 (0)