Skip to content

Commit 4f08041

Browse files
committed
cargo doc --open respect forced-target
1 parent 234d9f6 commit 4f08041

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cargo/ops/cargo_doc.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
2424
.root_crate_names
2525
.get(0)
2626
.ok_or_else(|| anyhow::anyhow!("no crates with documentation"))?;
27-
let kind = options.compile_opts.build_config.single_requested_kind()?;
27+
let pkg = ws
28+
.members()
29+
.find(|p| p.name().to_string() == *name.clone().replace("_", "-"))
30+
.unwrap();
31+
let kind = if let Some(forced_kind) = pkg.manifest().forced_kind() {
32+
// If the package's manifest specifies a forced kind, use that
33+
forced_kind
34+
} else {
35+
// Otherwise, use the single requested kind specified in the compile options
36+
options.compile_opts.build_config.single_requested_kind()?
37+
};
2838
let path = compilation.root_output[&kind]
2939
.with_file_name("doc")
3040
.join(&name)

0 commit comments

Comments
 (0)