Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove all transparent errors with from impl
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
simonsan committed Oct 17, 2024
1 parent 830280c commit ef7049a
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions crates/core/src/repofile/packfile.rs
Original file line number Diff line number Diff line change
@@ -27,16 +27,13 @@ pub enum PackFileErrorKind {
/// pack size computed from header doesn't match real pack isch! Computed: `{size_computed}`, real: `{size_real}`
HeaderPackSizeComputedDoesNotMatchRealPackFile { size_real: u32, size_computed: u32 },
/// partially reading the pack header from packfile failed: `{0:?}`
ListingKeyFilesFailed(#[from] BackendAccessErrorKind),
ListingKeyFilesFailed(BackendAccessErrorKind),
/// decrypting from binary failed
BinaryDecryptionFailed,
/// Partial read of PackFile failed
PartialReadOfPackfileFailed,
/// writing Bytes failed
WritingBytesFailed,
/// [`CryptBackendErrorKind`]
#[error(transparent)]
PackDecryptionFailed(#[from] CryptBackendErrorKind),
}

pub(crate) type PackFileResult<T> = Result<T, PackFileErrorKind>;
8 changes: 4 additions & 4 deletions crates/core/src/repofile/snapshotfile.rs
Original file line number Diff line number Diff line change
@@ -44,9 +44,9 @@ pub enum SnapshotFileErrorKind {
/// value `{0:?}` not allowed
ValueNotAllowed(String),
/// datetime out of range: `{0:?}`
OutOfRange(#[from] OutOfRangeError),
OutOfRange(OutOfRangeError),
/// reading the description file failed: `{0:?}`
ReadingDescriptionFailed(#[from] std::io::Error),
ReadingDescriptionFailed(std::io::Error),
/// getting the SnapshotFile from the backend failed
GettingSnapshotFileFailed,
/// getting the SnapshotFile by ID failed
@@ -979,7 +979,7 @@ impl Default for SnapshotGroupCriterion {
}

impl FromStr for SnapshotGroupCriterion {
type Err = RusticError;
type Err = SnapshotFileErrorKind;
fn from_str(s: &str) -> SnapshotFileResult<Self> {
let mut crit = Self::new();
for val in s.split(',') {
@@ -1085,7 +1085,7 @@ impl SnapshotGroup {
pub struct StringList(pub(crate) BTreeSet<String>);

impl FromStr for StringList {
type Err = RusticError;
type Err = SnapshotFileErrorKind;
fn from_str(s: &str) -> SnapshotFileResult<Self> {
Ok(Self(s.split(',').map(ToString::to_string).collect()))
}

0 comments on commit ef7049a

Please sign in to comment.