From 0b126f8ad3a2ac48fc4feffe86f3db2ddf653b9c Mon Sep 17 00:00:00 2001 From: wcampbell Date: Mon, 15 Jan 2024 22:09:45 -0500 Subject: [PATCH] Remove allocation for DekuError into io::Error --- CHANGELOG.md | 1 + backhand/src/error.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a0ab6bd..578ec695 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `backhand` - Enable overflow-checks ([#421](https://github.com/wcampbell0x2a/backhand/pull/421)) - Add feature `gzip-zune-inflate` to add a decompress only option with speed improvements ([#419](https://github.com/wcampbell0x2a/backhand/pull/419)) +- Remove allocation for `impl From for io::Error {` ([#425](https://github.com/wcampbell0x2a/backhand/pull/425)) ### `backhand-cli` - Enable overflow-checks for dist builds ([#421](https://github.com/wcampbell0x2a/backhand/pull/421)) diff --git a/backhand/src/error.rs b/backhand/src/error.rs index 9d168ec2..dd57e21c 100644 --- a/backhand/src/error.rs +++ b/backhand/src/error.rs @@ -58,19 +58,19 @@ impl From for io::Error { use BackhandError::*; match value { StdIo(io) => io, - Deku(e) => e.into(), - StringUtf8(e) => Self::new(io::ErrorKind::InvalidData, e), - StrUtf8(e) => Self::new(io::ErrorKind::InvalidData, e), - e @ UnsupportedCompression(_) => Self::new(io::ErrorKind::Unsupported, e), - e @ FileNotFound => Self::new(io::ErrorKind::NotFound, e), - e @ (Unreachable + StringUtf8(_) => Self::from(io::ErrorKind::InvalidData), + StrUtf8(_) => Self::from(io::ErrorKind::InvalidData), + UnsupportedCompression(_) => Self::from(io::ErrorKind::Unsupported), + FileNotFound => Self::from(io::ErrorKind::NotFound), + Unreachable + | Deku(_) | UnexpectedInode(_) | UnsupportedInode(_) | CorruptedOrInvalidSquashfs | InvalidCompressionOption | InvalidFilePath | UndefineFileName - | DuplicatedFileName) => Self::new(io::ErrorKind::InvalidData, e), + | DuplicatedFileName => Self::from(io::ErrorKind::InvalidData), } } }