Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix multi forbids #57

Merged
merged 2 commits into from May 21, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

`cargo fmt`

  • Loading branch information...
anderejd committed May 21, 2019
commit a6c47c4333bf3d55c09248b6d1fd6f8c5f201627
@@ -11,7 +11,6 @@ extern crate proc_macro2;
extern crate syn;
extern crate walkdir;


use self::walkdir::DirEntry;
use self::walkdir::WalkDir;
use std::error::Error;
@@ -210,36 +209,31 @@ fn file_forbids_unsafe(f: &syn::File) -> bool {
let unsafe_code_ident = Ident::new("unsafe_code", Span::call_site());
f.attrs
.iter()
.filter(|a| {
match a.style {
AttrStyle::Inner(_) => true,
_ => false,
}
})
.filter_map(|a| {
a.parse_meta().ok()
.filter(|a| match a.style {
AttrStyle::Inner(_) => true,
_ => false,
})
.filter(|meta| {
match meta {
Meta::List(MetaList {
ident,
paren_token: _paren,
nested
}) => {
if ident != &forbid_ident {
return false;
}
nested.iter().any(|n| {
match n {
NestedMeta::Meta(Meta::Word(word)) => word == &unsafe_code_ident,
_ => false,
}
})
.filter_map(|a| a.parse_meta().ok())
.filter(|meta| match meta {
Meta::List(MetaList {
ident,
paren_token: _paren,
nested,
}) => {
if ident != &forbid_ident {
return false;
}
_ => false,
nested.iter().any(|n| match n {
NestedMeta::Meta(Meta::Word(word)) => {
word == &unsafe_code_ident
}
_ => false,
})
}
_ => false,
})
.count() > 0
.count()
> 0
}

impl<'ast> visit::Visit<'ast> for GeigerSynVisitor {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.