Skip to content

Commit

Permalink
cargo doc --open respect forced-target
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Mar 6, 2023
1 parent 234d9f6 commit 4f08041
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cargo/ops/cargo_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
.root_crate_names
.get(0)
.ok_or_else(|| anyhow::anyhow!("no crates with documentation"))?;
let kind = options.compile_opts.build_config.single_requested_kind()?;
let pkg = ws
.members()
.find(|p| p.name().to_string() == *name.clone().replace("_", "-"))
.unwrap();
let kind = if let Some(forced_kind) = pkg.manifest().forced_kind() {
// If the package's manifest specifies a forced kind, use that
forced_kind
} else {
// Otherwise, use the single requested kind specified in the compile options
options.compile_opts.build_config.single_requested_kind()?
};
let path = compilation.root_output[&kind]
.with_file_name("doc")
.join(&name)
Expand Down

0 comments on commit 4f08041

Please sign in to comment.