Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(deps): use conflate instead of merge crate #1262

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simonsan
Copy link
Contributor

@simonsan simonsan commented Sep 26, 2024

Needs rustic-rs/rustic_core#284 to be merged and released first.

Fixes #1226

@simonsan simonsan added C-refactor Category: Refactoring of already existing code A-dependencies Area: Related to updating dependencies S-blocked Status: Blocked from merging/working on due to some issue labels Sep 26, 2024
@simonsan
Copy link
Contributor Author

simonsan commented Sep 26, 2024

/// Merge backup sources
///
/// If a source is already defined on left, use that. Else add it.
///
/// # Arguments
///
/// * `left` - Vector of backup sources
pub(crate) fn merge_sources(left: &mut Vec<BackupCmd>, mut right: Vec<BackupCmd>) {
    left.append(&mut right);
    left.sort_by(|opt1, opt2| opt1.sources.cmp(&opt2.sources));
    left.dedup_by(|opt1, opt2| opt1.sources == opt2.sources);
}

This could be a strategy, we could make more generic and move to the conflate crate. The question is though, if a HashMap/BTreeMap is better here instead, because we also deduplicate like that. Is there another reason to sort it?

@simonsan simonsan changed the title refactor: use conflate instead of merge crate refactor(deps): use conflate instead of merge crate Sep 30, 2024
@simonsan simonsan added this to the NEXT milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependencies Area: Related to updating dependencies C-refactor Category: Refactoring of already existing code S-blocked Status: Blocked from merging/working on due to some issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RUSTSEC-2024-0370: proc-macro-error is unmaintained
1 participant