diff --git a/Cargo.lock b/Cargo.lock index 7fb39b9..8fd56dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - [[package]] name = "allocator-api2" version = "0.2.21" @@ -74,19 +59,10 @@ dependencies = [ ] [[package]] -name = "backtrace" -version = "0.3.76" +name = "anyhow" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-link", -] +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "bitflags" @@ -152,7 +128,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -322,7 +298,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.111", + "syn", ] [[package]] @@ -333,7 +309,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -354,16 +330,16 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] name = "diskonaut" version = "0.12.0" dependencies = [ + "anyhow", "clap", "crossterm 0.29.0", - "failure", "filesize", "insta", "jwalk", @@ -410,28 +386,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - [[package]] name = "filesize" version = "0.2.0" @@ -453,12 +407,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" -[[package]] -name = "gimli" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" - [[package]] name = "hashbrown" version = "0.15.5" @@ -512,7 +460,7 @@ dependencies = [ "indoc", "proc-macro2", "quote", - "syn 2.0.111", + "syn", ] [[package]] @@ -594,21 +542,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "memchr" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", -] - [[package]] name = "mio" version = "1.1.0" @@ -633,15 +566,6 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.37.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.21.3" @@ -751,12 +675,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "rustc-demangle" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" - [[package]] name = "rustix" version = "0.38.44" @@ -874,18 +792,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.111", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "syn", ] [[package]] @@ -899,18 +806,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "unicode-ident" version = "1.0.22" @@ -946,12 +841,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "utf8parse" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index c607a7f..dd1fc1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ edition = "2024" [dependencies] ratatui = {version="0.29", default-features = false, features = ['crossterm'] } crossterm = "0.29" -failure = "0.1" +anyhow = "1" jwalk = "0.8" clap = { version = "4", features = ["derive"] } filesize = "0.2.0" diff --git a/src/main.rs b/src/main.rs index fad604e..509f89f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ mod state; mod ui; use ::clap::Parser; -use ::failure; use ::jwalk::Parallelism::{RayonDefaultPool, Serial}; use ::jwalk::WalkDir; use ::std::env; @@ -69,7 +68,7 @@ fn get_stdout() -> io::Result { Ok(io::stdout()) } -fn try_main() -> Result<(), failure::Error> { +fn try_main() -> Result<(), anyhow::Error> { let opts = Opt::parse(); match get_stdout() { @@ -82,7 +81,7 @@ fn try_main() -> Result<(), failure::Error> { None => env::current_dir()?, }; if !folder.as_path().is_dir() { - failure::bail!("Folder '{}' does not exist", folder.to_string_lossy()) + anyhow::bail!("Folder '{}' does not exist", folder.to_string_lossy()) } start( terminal_backend, @@ -92,7 +91,7 @@ fn try_main() -> Result<(), failure::Error> { opts.disable_delete_confirmation, ); } - Err(_) => failure::bail!("Failed to get stdout: are you trying to pipe 'diskonaut'?"), + Err(_) => anyhow::bail!("Failed to get stdout: are you trying to pipe 'diskonaut'?"), } disable_raw_mode()?; Ok(()) diff --git a/src/tests/cases/ui.rs b/src/tests/cases/ui.rs index 988aa5f..3e010ab 100644 --- a/src/tests/cases/ui.rs +++ b/src/tests/cases/ui.rs @@ -48,7 +48,7 @@ const SHOW_APPARENT_SIZE: bool = true; const DELETE_CONFIRMATION_ENABLED: bool = false; const DELETE_CONFIRMATION_DISABLED: bool = true; -fn create_root_temp_dir(name: &str) -> Result { +fn create_root_temp_dir(name: &str) -> Result { let mut dir = PathBuf::new(); dir.push(String::from("/tmp/diskonaut_tests")); // TODO: fix this for other platforms dir.push(name); @@ -58,7 +58,7 @@ fn create_root_temp_dir(name: &str) -> Result { Ok(dir) } -fn create_temp_file>(path: P, size: usize) -> Result<(), failure::Error> { +fn create_temp_file>(path: P, size: usize) -> Result<(), anyhow::Error> { let mut file = File::create(path)?; let mut pos = 0; while pos < size {