Skip to content

Commit

Permalink
macros: Drop anyhow dependency
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zecakeh committed Apr 21, 2024
1 parent d6f998e commit 2b03d9a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion gtk4-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions gtk4-macros/src/blueprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
let mut compiler = Command::new("blueprint-compiler")
Expand All @@ -24,7 +25,7 @@ pub(crate) fn compile_blueprint(blueprint: &[u8]) -> Result<String> {
compiler.stdout.unwrap().read_to_string(&mut buf)?;

Check failure on line 25 in gtk4-macros/src/blueprint.rs

View workflow job for this annotation

GitHub Actions / build

`?` couldn't convert the error to `syn::Error`

if !buf.starts_with('<') {
bail!(buf);
return Error::new(Span::call_site(), buf);

Check failure on line 28 in gtk4-macros/src/blueprint.rs

View workflow job for this annotation

GitHub Actions / build

mismatched types
}

Ok(buf)
Expand Down
6 changes: 1 addition & 5 deletions gtk4-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Check failure on line 57 in gtk4-macros/src/lib.rs

View workflow job for this annotation

GitHub Actions / build

no method named `into_compile_error` found for struct `std::io::Error` in the current scope
};

quote!({
Expand Down

0 comments on commit 2b03d9a

Please sign in to comment.