Skip to content

Commit b429f94

Browse files
committed
refactor(cli/rustup-mode): use early return in doc()
1 parent 1d65f01 commit b429f94

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/cli/rustup_mode.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,19 +1513,19 @@ async fn doc(
15131513
if path_only {
15141514
let doc_path = toolchain.doc_path(doc_url)?;
15151515
writeln!(cfg.process.stdout().lock(), "{}", doc_path.display())?;
1516-
Ok(utils::ExitCode(0))
1516+
return Ok(utils::ExitCode(0));
1517+
}
1518+
1519+
if let Some(name) = topic {
1520+
writeln!(
1521+
cfg.process.stderr().lock(),
1522+
"Opening docs named `{name}` in your browser"
1523+
)?;
15171524
} else {
1518-
if let Some(name) = topic {
1519-
writeln!(
1520-
cfg.process.stderr().lock(),
1521-
"Opening docs named `{name}` in your browser"
1522-
)?;
1523-
} else {
1524-
writeln!(cfg.process.stderr().lock(), "Opening docs in your browser")?;
1525-
}
1526-
toolchain.open_docs(doc_url)?;
1527-
Ok(utils::ExitCode(0))
1525+
writeln!(cfg.process.stderr().lock(), "Opening docs in your browser")?;
15281526
}
1527+
toolchain.open_docs(doc_url)?;
1528+
Ok(utils::ExitCode(0))
15291529
}
15301530

15311531
#[cfg(not(windows))]

0 commit comments

Comments
 (0)