]> git.lizzy.rs Git - rust.git/blobdiff - clippy_utils/src/attrs.rs
Arrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_de...
[rust.git] / clippy_utils / src / attrs.rs
index 5e44c7b3ee094048706f38e1f54b9698c14e40cb..c19b558cd8c6e044902c2713e8f169fd2113920d 100644 (file)
@@ -115,7 +115,7 @@ fn parse_attrs<F: FnMut(u64)>(sess: &Session, attrs: &[ast::Attribute], name: &'
     for attr in get_attr(sess, attrs, name) {
         if let Some(ref value) = attr.value_str() {
             if let Ok(value) = FromStr::from_str(&value.as_str()) {
-                f(value)
+                f(value);
             } else {
                 sess.span_err(attr.span, "not a number");
             }
@@ -154,6 +154,11 @@ pub fn is_doc_hidden(attrs: &[ast::Attribute]) -> bool {
     attrs
         .iter()
         .filter(|attr| attr.has_name(sym::doc))
-        .flat_map(ast::Attribute::meta_item_list)
+        .filter_map(ast::Attribute::meta_item_list)
         .any(|l| attr::list_contains_name(&l, sym::hidden))
 }
+
+/// Return true if the attributes contain `#[unstable]`
+pub fn is_unstable(attrs: &[ast::Attribute]) -> bool {
+    attrs.iter().any(|attr| attr.has_name(sym::unstable))
+}