Skip to content

Commit

Permalink
Correctly handle --open argument on doc command
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 21, 2021
1 parent 6265286 commit cc44ce0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,16 @@ impl Step for Std {
// Look for library/std, library/core etc in the `x.py doc` arguments and
// open the corresponding rendered docs.
for path in builder.paths.iter().map(components_simplified) {
if path.get(0) == Some(&"library") {
let requested_crate = &path[1];
if krates.contains(&requested_crate) {
let index = out.join(requested_crate).join("index.html");
open(builder, &index);
}
let requested_crate = if path.get(0) == Some(&"library") {
&path[1]
} else if !path.is_empty() {
&path[0]
} else {
continue;
};
if krates.contains(&requested_crate) {
let index = out.join(requested_crate).join("index.html");
open(builder, &index);
}
}
}
Expand Down

0 comments on commit cc44ce0

Please sign in to comment.