Skip to content

Commit a04f2b2

Browse files
committed
refactor: flatten log_compare into caller
1 parent bf0b156 commit a04f2b2

File tree

1 file changed

+19
-24
lines changed
  • src/cargo/core/compiler/fingerprint

1 file changed

+19
-24
lines changed

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

+19-24
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,25 @@ fn compare_old_fingerprint(
17501750
}
17511751

17521752
let compare = _compare_old_fingerprint(old_hash_path, new_fingerprint);
1753-
log_compare(unit, &compare);
1753+
1754+
match compare.as_ref() {
1755+
Ok(None) => {}
1756+
Ok(Some(reason)) => {
1757+
info!(
1758+
"fingerprint dirty for {}/{:?}/{:?}",
1759+
unit.pkg, unit.mode, unit.target,
1760+
);
1761+
info!(" dirty: {reason:?}");
1762+
}
1763+
Err(e) => {
1764+
info!(
1765+
"fingerprint error for {}/{:?}/{:?}",
1766+
unit.pkg, unit.mode, unit.target,
1767+
);
1768+
info!(" err: {e:?}");
1769+
}
1770+
}
1771+
17541772
match compare {
17551773
Ok(None) if forced => Some(DirtyReason::Forced),
17561774
Ok(reason) => reason,
@@ -1784,29 +1802,6 @@ fn _compare_old_fingerprint(
17841802
Ok(Some(new_fingerprint.compare(&old_fingerprint)))
17851803
}
17861804

1787-
/// Logs the result of fingerprint comparison.
1788-
///
1789-
/// TODO: Obsolete and mostly superseded by [`DirtyReason`]. Could be removed.
1790-
fn log_compare(unit: &Unit, compare: &CargoResult<Option<DirtyReason>>) {
1791-
match compare {
1792-
Ok(None) => {}
1793-
Ok(Some(reason)) => {
1794-
info!(
1795-
"fingerprint dirty for {}/{:?}/{:?}",
1796-
unit.pkg, unit.mode, unit.target,
1797-
);
1798-
info!(" dirty: {reason:?}");
1799-
}
1800-
Err(e) => {
1801-
info!(
1802-
"fingerprint error for {}/{:?}/{:?}",
1803-
unit.pkg, unit.mode, unit.target,
1804-
);
1805-
info!(" err: {e:?}");
1806-
}
1807-
}
1808-
}
1809-
18101805
/// Parses Cargo's internal [`EncodedDepInfo`] structure that was previously
18111806
/// serialized to disk.
18121807
///

0 commit comments

Comments
 (0)