Skip to content

Commit 89ab623

Browse files
committed
✨ Minor fixes && Version bump
1 parent 29122a4 commit 89ab623

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "flip-ui"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
edition = "2021"
55
authors = ["Nils Wrenger <nils@wrenger.net>"]
66
description = "Rust integration for handling and compiling the UI built via the UI Flip UI Builder"
@@ -19,7 +19,7 @@ targets = []
1919
harness = false
2020

2121
[dependencies]
22-
flip-ui-macro = { path = "macro", version = "0.1.2" }
22+
flip-ui-macro = { path = "macro", version = "0.1.3" }
2323
flipperzero = { git = "https://github.com/flipperzero-rs/flipperzero", version = "0.11.0" }
2424

2525
[dev-dependencies]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Add this to your `Cargo.toml`:
1818

1919
```toml
2020
[dependencies]
21-
flip_ui = "0.1.1"
21+
flip_ui = "0.1.3"
2222
```
2323

2424
## Example

macro/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "flip-ui-macro"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
edition = "2021"
55
description = "Procedural macros for flip-ui"
66
rust-version = "1.70.0"
@@ -17,4 +17,3 @@ serde_json = "1.0"
1717
quote = "1.0"
1818
syn = { version = "2.0.62", features = ["full"] }
1919
proc-macro2 = "1.0"
20-
proc-macro-error = "1.0.4"

macro/src/lib.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use std::{ffi::CString, fmt, fs};
44

55
use proc_macro as pc;
66
use proc_macro2::{Span, TokenStream};
7-
use proc_macro_error::{abort, proc_macro_error};
87
use quote::{quote, ToTokens};
98
use serde::Deserialize;
109
use syn::{parse::Parse, spanned::Spanned};
1110

11+
fn s_err(span: proc_macro2::Span, msg: impl fmt::Display) -> syn::Error {
12+
syn::Error::new(span, msg)
13+
}
14+
1215
/// Creates the App struct with the running logic
1316
///
1417
/// ## Helper Functions
@@ -28,7 +31,6 @@ use syn::{parse::Parse, spanned::Spanned};
2831
/// none => none,
2932
/// }
3033
/// ```
31-
#[proc_macro_error]
3234
#[proc_macro]
3335
pub fn flip_ui(input: pc::TokenStream) -> pc::TokenStream {
3436
match flip_ui_inner(input.into()) {
@@ -105,7 +107,10 @@ fn flip_ui_inner(input: TokenStream) -> syn::Result<TokenStream> {
105107

106108
// Check if there are unused handler
107109
if !used {
108-
abort!(ident.span(), format!("Unused handler function: {}", name));
110+
return Err(s_err(
111+
ident.span(),
112+
format!("Unused handler function: {}", name),
113+
));
109114
} else {
110115
used_handlers.push(name.clone());
111116
}
@@ -114,13 +119,13 @@ fn flip_ui_inner(input: TokenStream) -> syn::Result<TokenStream> {
114119
// Finally check if all functions could be satisfied
115120
for function in functions {
116121
if !used_handlers.contains(function) {
117-
abort!(
122+
return Err(s_err(
118123
Span::call_site(),
119124
format!(
120125
"Specified function '{}' does not have a corresponding handler.",
121126
function
122-
)
123-
);
127+
),
128+
));
124129
}
125130
}
126131

@@ -209,10 +214,6 @@ impl Parse for Args {
209214
}
210215
}
211216

212-
fn s_err(span: proc_macro2::Span, msg: impl fmt::Display) -> syn::Error {
213-
syn::Error::new(span, msg)
214-
}
215-
216217
#[derive(Deserialize)]
217218
struct Data {
218219
views: Vec<View>,

0 commit comments

Comments
 (0)