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 #284

Merged
merged 7 commits into from
Oct 1, 2024
Merged

Conversation

simonsan
Copy link
Contributor

@simonsan simonsan commented Sep 26, 2024

conflate (essentially merge 0.1.0-dev) lacks the blanket impl<T> Merge for Option<T>, which was removed from version 0.1.0

impl<T> Merge for Option<T> {
    fn merge(&mut self, mut other: Self) {
        if !self.is_some() {
            *self = other.take();
        }
    }
}

Hence, I added the overwrite_none strategies where needed.

We could also add it back, for a future version, though I think there was some decision involved, that strategies should be more explicit, because it could be confusing for strategies being applied without having an annotation. So I felt, I don't want to add that back to conflate for now.

Fixes #258

@simonsan simonsan added A-dependencies Area: Related to updating dependencies C-refactor Category: Refactoring of already existing code labels Sep 26, 2024
Copy link

codecov bot commented Sep 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.9%. Comparing base (25661d4) to head (05d79b2).

Additional details and impacted files
Files with missing lines Coverage Δ
crates/core/src/backend/ignore.rs 47.1% <ø> (+0.7%) ⬆️
crates/core/src/commands/backup.rs 62.5% <ø> (ø)
crates/core/src/commands/forget.rs 85.7% <ø> (ø)
crates/core/src/repofile/snapshotfile.rs 49.7% <ø> (+0.2%) ⬆️
crates/core/src/repository.rs 48.1% <ø> (ø)

... and 18 files with indirect coverage changes

@simonsan simonsan added the S-waiting-for-review Status: PRs waiting for review label Sep 30, 2024
@simonsan simonsan changed the title refactor: use conflate instead of merge crate refactor(deps): use conflate instead of merge crate Sep 30, 2024
crates/backend/src/choose.rs Outdated Show resolved Hide resolved
crates/backend/src/choose.rs Outdated Show resolved Hide resolved
crates/backend/src/choose.rs Outdated Show resolved Hide resolved
@simonsan
Copy link
Contributor Author

simonsan commented Oct 1, 2024

Removed/reverted the 'use provided hashmap strategy' commit, as that contains a breaking change for rustic and rustic_core (or rather rustic_backend? or both?) users, which we should do in another follow-up PR.

EDIT: Breaking change is in #291

Copy link
Member

@aawsome aawsome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Merged via the queue into main with commit 5980401 Oct 1, 2024
27 checks passed
@simonsan simonsan deleted the conflate branch October 1, 2024 21:14
@rustic-release-plz rustic-release-plz bot mentioned this pull request Oct 1, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 2, 2024
## 🤖 New release
* `rustic_backend`: 0.3.0 -> 0.4.0 (⚠️ API breaking changes)
* `rustic_core`: 0.4.0 -> 0.5.0 (⚠️ API breaking changes)
* `rustic_testing`: 0.2.1 -> 0.2.2 (✓ API compatible changes)

### ⚠️ `rustic_backend` breaking changes

```
--- failure enum_marked_non_exhaustive: enum marked #[non_exhaustive] ---

Description:
A public enum has been marked #[non_exhaustive]. Pattern-matching on it outside of its crate must now include a wildcard pattern like `_`, or it will fail to compile.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/enum_marked_non_exhaustive.ron

Failed in:
  enum LocalBackendErrorKind in /tmp/.tmpiqILEs/rustic_core/crates/backend/src/error.rs:90
  enum RestErrorKind in /tmp/.tmpiqILEs/rustic_core/crates/backend/src/error.rs:67
  enum BackendAccessErrorKind in /tmp/.tmpiqILEs/rustic_core/crates/backend/src/error.rs:10
  enum RcloneErrorKind in /tmp/.tmpiqILEs/rustic_core/crates/backend/src/error.rs:43

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/function_missing.ron

Failed in:
  function rustic_backend::choose::extend, previously in file /tmp/.tmpKTBBxT/rustic_backend/src/choose.rs:74

--- failure struct_marked_non_exhaustive: struct marked #[non_exhaustive] ---

Description:
A public struct has been marked #[non_exhaustive], which will prevent it from being constructed using a struct literal outside of its crate. It previously had no private fields, so a struct literal could be used to construct it outside its crate.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/struct_marked_non_exhaustive.ron

Failed in:
  struct BackendOptions in /tmp/.tmpiqILEs/rustic_core/crates/backend/src/choose.rs:35
  struct BackendOptions in /tmp/.tmpiqILEs/rustic_core/crates/backend/src/choose.rs:35
```

### ⚠️ `rustic_core` breaking changes

```
--- failure enum_marked_non_exhaustive: enum marked #[non_exhaustive] ---

Description:
A public enum has been marked #[non_exhaustive]. Pattern-matching on it outside of its crate must now include a wildcard pattern like `_`, or it will fail to compile.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/enum_marked_non_exhaustive.ron

Failed in:
  enum LimitOption in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/prune.rs:253

--- failure struct_marked_non_exhaustive: struct marked #[non_exhaustive] ---

Description:
A public struct has been marked #[non_exhaustive], which will prevent it from being constructed using a struct literal outside of its crate. It previously had no private fields, so a struct literal could be used to construct it outside its crate.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/struct_marked_non_exhaustive.ron

Failed in:
  struct RestoreOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/restore.rs:49
  struct RepoFileInfos in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/repoinfo.rs:163
  struct KeyOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/key.rs:17
  struct BlobInfo in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/repoinfo.rs:31
  struct FileDirStats in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/restore.rs:74
  struct CheckOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/check.rs:125
  struct ConfigOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/config.rs:107
  struct IndexInfos in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/repoinfo.rs:17
  struct PackInfo in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/repoinfo.rs:64
  struct TreeStreamerOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/blob/tree.rs:401
  struct PruneOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/prune.rs:58
  struct RepairSnapshotsOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/repair/snapshots.rs:29
  struct RestoreStats in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/restore.rs:90
  struct RepoFileInfo in /tmp/.tmpiqILEs/rustic_core/crates/core/src/commands/repoinfo.rs:173
  struct LocalSourceFilterOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/backend/ignore.rs:71
  struct LocalSourceSaveOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/backend/ignore.rs:51
  struct RepositoryOptions in /tmp/.tmpiqILEs/rustic_core/crates/core/src/repository.rs:88
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `rustic_backend`
<blockquote>

##
[0.4.0](rustic_backend-v0.3.0...rustic_backend-v0.4.0)
- 2024-10-02

### Fixed

- Add #[non_exhaustive] to pub structs which may be extended in future
([#293](#293))
- *(backend)* [**breaking**] Use correct merge stratgy for repository
options ([#291](#291))

### Other

- *(deps)* update dependencies
([#292](#292))
- *(deps)* use conflate instead of merge crate
([#284](#284))
</blockquote>

## `rustic_core`
<blockquote>

##
[0.5.0](rustic_core-v0.4.0...rustic_core-v0.5.0)
- 2024-10-02

### Added

- Add read-data-subset to CheckOptions; allow to check given trees
([#262](#262))
- Add Repository method to update snapshot collections
([#260](#260))

### Fixed

- Add #[non_exhaustive] to pub structs which may be extended in future
([#293](#293))
- Don't query the default cache directory when a custom one is set
([#285](#285))

### Other

- *(deps)* update dependencies
([#292](#292))
- *(deps)* use conflate instead of merge crate
([#284](#284))
</blockquote>

## `rustic_testing`
<blockquote>

##
[0.2.2](rustic_testing-v0.2.1...rustic_testing-v0.2.2)
- 2024-10-02

### Other

- *(deps)* update dependencies
([#292](#292))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: rustic-release-plz[bot] <182542030+rustic-release-plz[bot]@users.noreply.github.com>
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-waiting-for-review Status: PRs waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RUSTSEC-2024-0370: proc-macro-error is unmaintained
2 participants