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..e0f981818bfa 100644 --- a/gtk4-macros/src/blueprint.rs +++ b/gtk4-macros/src/blueprint.rs @@ -5,7 +5,8 @@ use std::{ process::{Command, Stdio}, }; -use anyhow::{bail, Result}; +use proc_macro2::Span; +use syn::{Error, Result}; pub(crate) fn compile_blueprint(blueprint: &[u8]) -> Result { let mut compiler = Command::new("blueprint-compiler") @@ -24,7 +25,7 @@ pub(crate) fn compile_blueprint(blueprint: &[u8]) -> Result { compiler.stdout.unwrap().read_to_string(&mut buf)?; if !buf.starts_with('<') { - bail!(buf); + return Error::new(Span::call_site(), buf); } Ok(buf) diff --git a/gtk4-macros/src/lib.rs b/gtk4-macros/src/lib.rs index 708fe008a982..9a7604ae0681 100644 --- a/gtk4-macros/src/lib.rs +++ b/gtk4-macros/src/lib.rs @@ -54,11 +54,7 @@ pub fn include_blueprint(input: TokenStream) -> TokenStream { let template = match std::fs::read_to_string(&path) { Ok(content) => blueprint::compile_blueprint(content.as_bytes()).unwrap(), - Err(err) => { - return Error::new(Span::call_site(), err) - .into_compile_error() - .into() - } + Err(err) => return err.into_compile_error().into(), }; quote!({