diff --git a/Cargo.lock b/Cargo.lock index 165fa413..5e94f994 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "aho-corasick" version = "1.1.2" @@ -74,21 +59,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.21.4" @@ -113,15 +83,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -159,7 +120,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn", ] [[package]] @@ -193,11 +154,11 @@ dependencies = [ "base64", "bitflags 2.4.0", "byteorder", - "failure", "lazy_static", "ntapi", "serde", "serde_derive", + "thiserror", "toml", "uuid", "version-sync", @@ -226,28 +187,6 @@ dependencies = [ "windows-sys", ] -[[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 = "fastrand" version = "2.0.1" @@ -263,12 +202,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "gimli" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" - [[package]] name = "hashbrown" version = "0.14.1" @@ -334,15 +267,6 @@ version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - [[package]] name = "ntapi" version = "0.4.1" @@ -352,15 +276,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - [[package]] name = "percent-encoding" version = "2.3.0" @@ -434,12 +349,6 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustix" version = "0.38.19" @@ -476,7 +385,7 @@ checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn", ] [[package]] @@ -494,17 +403,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[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", -] - [[package]] name = "syn" version = "2.0.38" @@ -516,18 +414,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 = "tempfile" version = "3.8.0" @@ -541,6 +427,26 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "thiserror" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -620,12 +526,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "url" version = "2.4.1" @@ -662,7 +562,7 @@ dependencies = [ "pulldown-cmark", "regex", "semver", - "syn 2.0.38", + "syn", "toml", "url", ] diff --git a/efivar/Cargo.toml b/efivar/Cargo.toml index 374acc6d..be272102 100644 --- a/efivar/Cargo.toml +++ b/efivar/Cargo.toml @@ -17,7 +17,6 @@ edition = "2018" [dependencies] byteorder = "1.4.3" bitflags = "2.3.3" -failure = "0.1.8" base64 = { version = "0.21.2", optional = true } serde = { version = "1.0.171", optional = true } @@ -26,6 +25,7 @@ toml = { version = "0.7.6", optional = true } uuid = { version = "1.4.1", features = ["serde"] } lazy_static = "1.4.0" ntapi = "0.4.1" +thiserror = "1.0.49" [features] store = ["base64", "serde", "serde_derive", "toml"] diff --git a/efivar/src/error.rs b/efivar/src/error.rs index bbd2bf5a..fdf56489 100644 --- a/efivar/src/error.rs +++ b/efivar/src/error.rs @@ -3,35 +3,35 @@ use std::io; use crate::efi::Variable; /// Describes an error returned by EFI variable operations -#[derive(Debug, Fail)] +#[derive(Debug, thiserror::Error)] pub enum Error { - #[fail(display = "failed to parse variable name: {}", name)] + #[error("failed to parse variable name: {}", name)] InvalidVarName { name: String }, - #[fail(display = "variable not found: {}", name)] + #[error("variable not found: {}", name)] VarNotFound { name: Variable }, - #[fail(display = "permission denied for variable: {}", name)] + #[error("permission denied for variable: {}", name)] PermissionDenied { name: Variable }, - #[fail(display = "unknown i/o error for variable: {}", name)] + #[error("unknown i/o error for variable: {}", name)] VarUnknownError { name: Variable, error: io::Error }, - #[fail(display = "base64 decoding error: {}", error)] + #[error("base64 decoding error: {}", error)] #[cfg(feature = "store")] Base64DecodeError { error: base64::DecodeError }, - #[fail(display = "base64 decoding error: {}", error)] + #[error("base64 decoding error: {}", error)] #[cfg(feature = "store")] Base64DecodeSliceError { error: base64::DecodeSliceError }, - #[fail(display = "unknown i/o error")] + #[error("unknown i/o error")] UnknownIoError { error: io::Error }, - #[fail(display = "unknown EFI variable flag: '{}'", flag)] + #[error("unknown EFI variable flag: '{}'", flag)] UnknownFlag { flag: String }, - #[fail(display = "failed to decode name as valid UTF-8")] + #[error("failed to decode name as valid UTF-8")] InvalidUTF8, - #[fail(display = "buffer too small for variable: {}", name)] + #[error("buffer too small for variable: {}", name)] BufferTooSmall { name: Variable }, - #[fail(display = "failed to decode uuid: {}", error)] + #[error("failed to decode uuid: {}", error)] UuidError { error: uuid::Error }, - #[fail(display = "failed to parse variable content (invalid content)")] + #[error("failed to parse variable content (invalid content)")] VarParseError, - #[fail(display = "failed to parse string: {}", 0)] + #[error("failed to parse string: {}", 0)] StringParseError(crate::utils::StringParseError), } diff --git a/efivar/src/lib.rs b/efivar/src/lib.rs index 4ce2e08c..85cdf9be 100644 --- a/efivar/src/lib.rs +++ b/efivar/src/lib.rs @@ -17,8 +17,6 @@ #[macro_use] extern crate bitflags; #[macro_use] -extern crate failure; -#[macro_use] extern crate lazy_static; #[cfg(feature = "store")] #[macro_use] diff --git a/efivar/src/utils.rs b/efivar/src/utils.rs index 5c3be8ab..2faf4b18 100644 --- a/efivar/src/utils.rs +++ b/efivar/src/utils.rs @@ -1,12 +1,12 @@ use byteorder::{LittleEndian, ReadBytesExt}; -#[derive(Debug, Fail)] +#[derive(Debug, thiserror::Error)] pub enum StringParseError { /// occurs when you get an error while reading the data - #[fail(display = "Buffer read error: {}", 0)] + #[error("Buffer read error: {}", 0)] Read(std::io::Error), /// occurs when the bytes are not a valid UTF-16 string - #[fail(display = "Buffer parse error: {}", 0)] + #[error("Buffer parse error: {}", 0)] Parse(std::string::FromUtf16Error), }