Refactor has_no_mangle to make it easier to match repr(C) which we'll need later

This commit is contained in:
Kartikaya Gupta
2017-04-04 10:24:05 -04:00
parent 4c559a4e47
commit af1bc992d6
+8 -8
View File
@@ -4,15 +4,15 @@ use std::io::Read;
extern crate syn;
use syn::*;
fn has_attribute(target: MetaItem, attrs: &Vec<Attribute>) -> bool {
return attrs.iter().any(|ref attr| {
attr.style == AttrStyle::Outer &&
attr.value == target
});
}
fn has_no_mangle(attrs: &Vec<Attribute>) -> bool {
for attr in attrs {
if let syn::MetaItem::Word(ref ident) = attr.value {
if ident == "no_mangle" {
return true;
}
}
}
false
has_attribute(MetaItem::Word(Ident::new("no_mangle")), attrs)
}
fn map_path(p: &Path) -> String {