Skip to content

Commit cc44ce0

Browse files
Correctly handle --open argument on doc command
1 parent 6265286 commit cc44ce0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/bootstrap/doc.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,16 @@ impl Step for Std {
479479
// Look for library/std, library/core etc in the `x.py doc` arguments and
480480
// open the corresponding rendered docs.
481481
for path in builder.paths.iter().map(components_simplified) {
482-
if path.get(0) == Some(&"library") {
483-
let requested_crate = &path[1];
484-
if krates.contains(&requested_crate) {
485-
let index = out.join(requested_crate).join("index.html");
486-
open(builder, &index);
487-
}
482+
let requested_crate = if path.get(0) == Some(&"library") {
483+
&path[1]
484+
} else if !path.is_empty() {
485+
&path[0]
486+
} else {
487+
continue;
488+
};
489+
if krates.contains(&requested_crate) {
490+
let index = out.join(requested_crate).join("index.html");
491+
open(builder, &index);
488492
}
489493
}
490494
}

0 commit comments

Comments
 (0)