pub fn should_replace_duplicate(
existing: &LockedResource,
new_entry: &LockedResource,
) -> boolExpand description
Determines if a new lockfile entry should replace an existing duplicate entry.
Uses a deterministic merge strategy to ensure consistent lockfile generation regardless of processing order (e.g., HashMap iteration order).
§Merge Priority Rules (highest to lowest)
- Manifest dependencies win - Direct manifest dependencies (with
manifest_alias) always take precedence over transitive dependencies - install=true wins - Dependencies that create files (
install=true) are preferred over content-only dependencies (install=false) - First wins - If both have equal priority, keep the existing entry
This ensures that the lockfile is deterministic even when:
- Dependencies are processed in different orders
- HashMap iteration order varies between runs
- Multiple parents declare the same transitive dependency with different settings
§Arguments
existing- The current entry in the lockfilenew_entry- The new entry being added
§Returns
true if the new entry should replace the existing one, false otherwise