Skip to content

Commit 7fbb320

Browse files
authored
Remove intermediate anyhow usage and just rely on LeptonError for returning errors (#111)
* removed anyhow and reformatted * work * fixed intermittant error
1 parent b94d626 commit 7fbb320

30 files changed

+411
-602
lines changed

Cargo.lock

Lines changed: 8 additions & 127 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ bytemuck = "1"
3232
byteorder = "1.4"
3333
flate2 = "1.0"
3434
default-boxed = "0.2"
35-
anyhow = { version="1.0", features = ["backtrace"]}
3635
wide = "0.7"
3736
log = "0.4"
3837
simple_logger ="5.0"

src/helpers.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@ use std::panic::{catch_unwind, AssertUnwindSafe};
88

99
use crate::lepton_error::{ExitCode, LeptonError};
1010

11-
macro_rules! here {
12-
() => {
13-
concat!("at ", file!(), " line ", line!())
14-
};
15-
}
16-
17-
pub(crate) use here;
18-
1911
/// Helper function to catch panics and convert them into the appropriate LeptonError
2012
pub fn catch_unwind_result<R>(
21-
f: impl FnOnce() -> Result<R, anyhow::Error>,
13+
f: impl FnOnce() -> Result<R, LeptonError>,
2214
) -> Result<R, LeptonError> {
2315
match catch_unwind(AssertUnwindSafe(f)) {
2416
Ok(r) => r.map_err(|e| e.into()),
@@ -85,11 +77,6 @@ pub const fn u32_bit_length(v: u32) -> u8 {
8577
return 32 - v.leading_zeros() as u8;
8678
}
8779

88-
#[cold]
89-
pub fn err_exit_code<T>(error_code: ExitCode, message: &str) -> anyhow::Result<T> {
90-
return Err(anyhow::Error::new(LeptonError::new(error_code, message)));
91-
}
92-
9380
pub fn buffer_prefix_matches_marker<const BS: usize, const MS: usize>(
9481
buffer: [u8; BS],
9582
marker: [u8; MS],

0 commit comments

Comments
 (0)