Skip to content

Commit

Permalink
fix: resolve breaking changes
Browse files Browse the repository at this point in the history
- unwrap_or_abort() to unwrap()
- remove redundant ResultExt
- allow unnecessary find_map
  • Loading branch information
gortavoher committed Dec 27, 2023
1 parent 1ad4ee9 commit a46fce0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dynomite-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "../README.md"
documentation = "https://docs.rs/dynomite-derive"
homepage = "https://github.com/softprops/dynomite"
repository = "https://github.com/softprops/dynomite"
edition = "2018"
edition = "2021"

[badges]
coveralls = { repository = "softprops/dynomite" }
Expand All @@ -20,6 +20,6 @@ proc-macro = true

[dependencies]
quote = "^1.0"
syn = "^1.0"
syn = "2.0.43"
proc-macro2 = "^1.0"
proc-macro-error = "1.0"
9 changes: 6 additions & 3 deletions dynomite-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use attr::{EnumAttr, EnumAttrKind, FieldAttr, FieldAttrKind, VariantAttr};

use proc_macro::TokenStream;
use proc_macro2::Span;
use proc_macro_error::{abort, ResultExt};
use proc_macro_error::abort;
use quote::{quote, ToTokens};
use syn::{
parse::Parse, punctuated::Punctuated, Attribute, DataStruct, DeriveInput, Field, Fields, Ident,
Expand All @@ -49,6 +49,7 @@ struct Variant {

impl Variant {
fn deser_name(&self) -> String {
#[allow(clippy::unnecessary_find_map)]
self.attrs
.iter()
.find_map(|it| match &it.kind {
Expand Down Expand Up @@ -99,6 +100,7 @@ impl DataEnum {
}

fn tag_key(&self) -> String {
#[allow(clippy::unnecessary_find_map)]
self.attrs
.iter()
.find_map(|attr| match &attr.kind {
Expand Down Expand Up @@ -293,7 +295,8 @@ fn parse_attrs<A: Parse>(all_attrs: &[Attribute]) -> Vec<A> {
.filter(|attr| is_dynomite_attr(attr))
.flat_map(|attr| {
attr.parse_args_with(Punctuated::<A, Token![,]>::parse_terminated)
.unwrap_or_abort()
// .unwrap_or_abort()
.unwrap()
})
.collect()
}
Expand Down Expand Up @@ -813,5 +816,5 @@ fn get_key_struct(
}

fn is_dynomite_attr(suspect: &syn::Attribute) -> bool {
suspect.path.is_ident("dynomite")
suspect.path().is_ident("dynomite")
}

0 comments on commit a46fce0

Please sign in to comment.