address more review comments

This commit is contained in:
Manish Goregaokar 2015-05-13 12:23:43 +05:30
parent 96e1cf3b06
commit 22b720a920
3 changed files with 9 additions and 7 deletions

View File

@ -137,7 +137,7 @@ impl<'a> Registry<'a> {
}
/// Register an attribute with an attribute type
/// Register an attribute with an attribute type.
///
/// Registered attributes will bypass the `custom_attribute` feature gate.
/// `Whitelisted` attributes will additionally not trigger the `unused_attribute`

View File

@ -643,11 +643,8 @@ impl LintPass for UnusedAttributes {
let plugin_attributes = cx.sess().plugin_attributes.borrow_mut();
for &(ref name, ty) in plugin_attributes.iter() {
match ty {
AttributeType::Whitelisted if attr.check_name(&*name) => {
break;
},
_ => ()
if ty == AttributeType::Whitelisted && attr.check_name(&*name) {
break;
}
}

View File

@ -389,6 +389,8 @@ impl<'a> Context<'a> {
for &(ref n, ref ty) in self.plugin_attributes.iter() {
if &*n == name {
// Plugins can't gate attributes, so we don't check for it
// unlike the code above; we only use this loop to
// short-circuit to avoid the checks below
debug!("check_attribute: {:?} is registered by a plugin, {:?}", name, ty);
return;
}
@ -403,7 +405,10 @@ impl<'a> Context<'a> {
"attributes of the form `#[derive_*]` are reserved \
for the compiler");
} else {
// Only do the custom attribute lint post-expansion
// Only run the custom attribute lint during regular
// feature gate checking. Macro gating runs
// before the plugin attributes are registered
// so we skip this then
if !is_macro {
self.gate_feature("custom_attribute", attr.span,
&format!("The attribute `{}` is currently \