From 7cf87d984f42af4e9346b2de6b6e81bc94c4f784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sun, 21 Apr 2024 17:01:44 +0200 Subject: [PATCH] macros: Drop anyhow dependency It is used in a single place and it is easy to remove, so it doesn't seem worth it to keep depending on it. --- Cargo.lock | 7 ------- gtk4-macros/Cargo.toml | 1 - gtk4-macros/src/blueprint.rs | 6 ++---- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61760076f3cd..cf0f54f7484f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,12 +32,6 @@ dependencies = [ "libc", ] -[[package]] -name = "anyhow" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" - [[package]] name = "async-channel" version = "2.2.1" @@ -807,7 +801,6 @@ dependencies = [ name = "gtk4-macros" version = "0.9.0" dependencies = [ - "anyhow", "futures-channel", "futures-util", "gtk4", diff --git a/gtk4-macros/Cargo.toml b/gtk4-macros/Cargo.toml index e598829dc3bf..d0d572c7b4c0 100644 --- a/gtk4-macros/Cargo.toml +++ b/gtk4-macros/Cargo.toml @@ -21,7 +21,6 @@ xml_validation = ["quick-xml"] blueprint = [] [dependencies] -anyhow = "1.0" quick-xml = {version = "0.31", optional = true} proc-macro-crate = "3.0" proc-macro2 = "1.0" diff --git a/gtk4-macros/src/blueprint.rs b/gtk4-macros/src/blueprint.rs index 9386bc7aee4f..a10e0a59c502 100644 --- a/gtk4-macros/src/blueprint.rs +++ b/gtk4-macros/src/blueprint.rs @@ -1,12 +1,10 @@ // Take a look at the license at the top of the repository in the LICENSE file. use std::{ - io::{Read, Write}, + io::{Error, ErrorKind, Read, Result, Write}, process::{Command, Stdio}, }; -use anyhow::{bail, Result}; - pub(crate) fn compile_blueprint(blueprint: &[u8]) -> Result { let mut compiler = Command::new("blueprint-compiler") .args(["compile", "-"]) @@ -24,7 +22,7 @@ pub(crate) fn compile_blueprint(blueprint: &[u8]) -> Result { compiler.stdout.unwrap().read_to_string(&mut buf)?; if !buf.starts_with('<') { - bail!(buf); + return Err(Error::new(ErrorKind::Other, buf)); } Ok(buf)