Skip to content

Commit 918720b

Browse files
committed
refactor(rustdoc): extract fingerprint path to fn
1 parent 5df2bf6 commit 918720b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/cargo/core/compiler/fingerprint/rustdoc.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::path::Path;
2+
use std::path::PathBuf;
23

34
use anyhow::Context as _;
45
use cargo_util::paths;
@@ -63,18 +64,23 @@ impl RustdocFingerprint {
6364
}
6465
}
6566

67+
/// Returns the path to rustdoc fingerprint file for a given [`CompileKind`].
68+
fn fingerprint_path(build_runner: &BuildRunner<'_, '_>, kind: CompileKind) -> PathBuf {
69+
build_runner
70+
.files()
71+
.layout(kind)
72+
.build_dir()
73+
.root()
74+
.join(".rustdoc_fingerprint.json")
75+
}
76+
6677
/// Checks rustdoc fingerprint file for a given [`CompileKind`].
6778
fn check_fingerprint(
6879
build_runner: &BuildRunner<'_, '_>,
6980
new_fingerprint: &RustdocFingerprint,
7081
kind: CompileKind,
7182
) -> CargoResult<()> {
72-
let fingerprint_path = build_runner
73-
.files()
74-
.layout(kind)
75-
.build_dir()
76-
.root()
77-
.join(".rustdoc_fingerprint.json");
83+
let fingerprint_path = fingerprint_path(build_runner, kind);
7884

7985
let write_fingerprint = || -> CargoResult<()> {
8086
paths::write(&fingerprint_path, serde_json::to_string(new_fingerprint)?)

0 commit comments

Comments
 (0)