Skip to content

Commit adf047d

Browse files
committed
Auto merge of #6449 - dwijnand:extract-Fingerprint-new, r=alexcrichton
Extract Fingerprint::new None
2 parents db0bb7f + 37956e8 commit adf047d

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

src/cargo/core/compiler/fingerprint.rs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,9 @@ where
193193
pkg_id,
194194
name,
195195
Arc::new(Fingerprint {
196-
rustc: 0,
197-
target: 0,
198-
profile: 0,
199-
path: 0,
200196
local: vec![LocalFingerprint::Precalculated(String::new())],
201-
features: String::new(),
202-
deps: Vec::new(),
203197
memoized_hash: Mutex::new(Some(hash)),
204-
edition: Edition::Edition2015,
205-
rustflags: Vec::new(),
198+
..Fingerprint::new()
206199
}),
207200
)
208201
})
@@ -228,6 +221,21 @@ impl LocalFingerprint {
228221
struct MtimeSlot(Mutex<Option<FileTime>>);
229222

230223
impl Fingerprint {
224+
fn new() -> Fingerprint {
225+
Fingerprint {
226+
rustc: 0,
227+
target: 0,
228+
profile: 0,
229+
path: 0,
230+
features: String::new(),
231+
deps: Vec::new(),
232+
local: Vec::new(),
233+
memoized_hash: Mutex::new(None),
234+
edition: Edition::Edition2015,
235+
rustflags: Vec::new(),
236+
}
237+
}
238+
231239
fn update_local(&self, root: &Path) -> CargoResult<()> {
232240
let mut hash_busted = false;
233241
for local in self.local.iter() {
@@ -529,18 +537,7 @@ pub fn prepare_build_cmd<'a, 'cfg>(
529537
debug!("fingerprint at: {}", loc.display());
530538

531539
let (local, output_path) = build_script_local_fingerprints(cx, unit)?;
532-
let mut fingerprint = Fingerprint {
533-
rustc: 0,
534-
target: 0,
535-
profile: 0,
536-
path: 0,
537-
features: String::new(),
538-
deps: Vec::new(),
539-
local,
540-
memoized_hash: Mutex::new(None),
541-
edition: Edition::Edition2015,
542-
rustflags: Vec::new(),
543-
};
540+
let mut fingerprint = Fingerprint { local, ..Fingerprint::new() };
544541
let compare = compare_old_fingerprint(&loc, &fingerprint);
545542
log_compare(unit, &compare);
546543

0 commit comments

Comments
 (0)