Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenByteDev committed Jul 5, 2022
1 parent ed7152e commit 4ff819f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions dlopen2-derive/src/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use syn::{Data, DeriveInput, Field, Fields, FieldsNamed, Lit, Meta, Attribute};
use syn::{Attribute, Data, DeriveInput, Field, Fields, FieldsNamed, Lit, Meta};

pub fn symbol_name(field: &Field) -> String {
match find_str_attr_val(field, "dlopen2_name") {
Expand Down Expand Up @@ -33,14 +33,18 @@ pub fn find_str_attr_val(field: &Field, attr_name: &str) -> Option<String> {
}

pub fn get_non_marker_attrs(field: &Field) -> Vec<&Attribute> {
field.attrs.iter().filter(|attr| {
if let Some(ident) = attr.path.get_ident() {
if ident.to_string().starts_with("dlopen2_") {
return false;
field
.attrs
.iter()
.filter(|attr| {
if let Some(ident) = attr.path.get_ident() {
if ident.to_string().starts_with("dlopen2_") {
return false;
}
}
}
true
}).collect::<Vec<_>>()
true
})
.collect::<Vec<_>>()
}

pub fn has_marker_attr(field: &Field, attr_name: &str) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion dlopen2-derive/src/wrapper.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::common::{get_fields, has_marker_attr, symbol_name, get_non_marker_attrs};
use super::common::{get_fields, get_non_marker_attrs, has_marker_attr, symbol_name};
use quote::quote;
use syn::{self, BareFnArg, DeriveInput, Field, Type, TypePtr, Visibility};

Expand Down

0 comments on commit 4ff819f

Please sign in to comment.