Skip to content

Commit 0989dc1

Browse files
committed
Put cfg in a scope so it's not borrowed twice
1 parent 0cecbd6 commit 0989dc1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/cargo/ops/cargo_doc.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ pub fn doc(ws: &Workspace<'_>, options: &DocOptions) -> CargoResult<()> {
3535
.join(&name)
3636
.join("index.html");
3737
if path.exists() {
38+
let config_browser = {
39+
let cfg = ws.config().get::<CargoDocConfig>("doc")?;
40+
41+
cfg.browser
42+
.map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args))
43+
};
44+
3845
let mut shell = ws.config().shell();
3946
shell.status("Opening", path.display())?;
40-
let cfg = ws.config().get::<CargoDocConfig>("doc")?;
41-
open_docs(
42-
&path,
43-
&mut shell,
44-
cfg.browser
45-
.map(|path_args| (path_args.path.resolve_program(ws.config()), path_args.args)),
46-
)?;
47+
open_docs(&path, &mut shell, config_browser)?;
4748
}
4849
}
4950

0 commit comments

Comments
 (0)