Skip to content

Commit

Permalink
[refactor] #4290: Replace parse_display crate with strum (#4401)
Browse files Browse the repository at this point in the history
Signed-off-by: Nurzhan Sakén <nurzhan.sakenov@gmail.com>
  • Loading branch information
nxsaken authored Apr 3, 2024
1 parent 6387b54 commit 172769c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 64 deletions.
57 changes: 1 addition & 56 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion ffi/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ manyhow = { workspace = true }
darling = { workspace = true }
rustc-hash = { workspace = true }

parse-display = "0.8.2"
strum = { workspace = true, features = ["derive"] }

[dev-dependencies]
iroha_ffi = { workspace = true }
Expand Down
8 changes: 4 additions & 4 deletions ffi/derive/src/attr_parse/getset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

use std::{collections::hash_map::Entry, str::FromStr};

use parse_display::{Display, FromStr};
use proc_macro2::Span;
use rustc_hash::{FxHashMap, FxHashSet};
use strum::{Display, EnumString};
use syn::{parse::ParseStream, punctuated::Punctuated, Attribute, Token};

use crate::attr_parse::derive::{Derive, DeriveAttrs};

/// Type of accessor method derived for a structure
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display, FromStr)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display, EnumString)]
pub enum GetSetDerive {
Setters,
Getters,
Expand Down Expand Up @@ -104,8 +104,8 @@ impl syn::parse::Parse for SpannedGetSetOptions {
}
}

#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Display, FromStr)]
#[display(style = "snake_case")]
#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone, Display, EnumString)]
#[strum(serialize_all = "snake_case")]
pub enum GetSetGenMode {
Get,
GetCopy,
Expand Down
6 changes: 3 additions & 3 deletions ffi/derive/src/attr_parse/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
use std::str::FromStr;

use darling::{error::Accumulator, util::SpannedValue, FromAttributes};
use parse_display::{Display, FromStr};
use proc_macro2::{Delimiter, Span};
use strum::{Display, EnumString};
use syn::{
parse::{Parse, ParseStream},
punctuated::Punctuated,
spanned::Spanned as _,
Attribute, Meta, Token,
};

#[derive(Debug, Copy, Clone, Eq, PartialEq, Display, FromStr)]
#[display(style = "lowercase")]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Display, EnumString)]
#[strum(serialize_all = "lowercase")]
pub enum ReprPrimitive {
U8,
U16,
Expand Down

0 comments on commit 172769c

Please sign in to comment.