about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-02-05 15:11:27 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2019-02-05 15:11:27 +1100
commitf97e896fd669b61051027d76d6dccb89c72c4c52 (patch)
tree8c2b3559423d67572625270d54e7f0a3ee9d7407 /src/libsyntax/ext
parenteea2dfe76f7afea0df3ae99fcdd30f1afbf4402d (diff)
downloadrust-f97e896fd669b61051027d76d6dccb89c72c4c52.tar.gz
rust-f97e896fd669b61051027d76d6dccb89c72c4c52.zip
Simplify `fold_attribute`.
It doesn't need to return an `Option`.
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/expand.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 957187ec71c..72e0a86bf59 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1465,7 +1465,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
         noop_fold_generic_param(param, self)
     }
 
-    fn fold_attribute(&mut self, at: ast::Attribute) -> Option<ast::Attribute> {
+    fn fold_attribute(&mut self, at: ast::Attribute) -> ast::Attribute {
         // turn `#[doc(include="filename")]` attributes into `#[doc(include(file="filename",
         // contents="file contents")]` attributes
         if !at.check_name("doc") {
@@ -1585,10 +1585,8 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
 
             let meta = attr::mk_list_item(DUMMY_SP, Ident::from_str("doc"), items);
             match at.style {
-                ast::AttrStyle::Inner =>
-                    Some(attr::mk_spanned_attr_inner(at.span, at.id, meta)),
-                ast::AttrStyle::Outer =>
-                    Some(attr::mk_spanned_attr_outer(at.span, at.id, meta)),
+                ast::AttrStyle::Inner => attr::mk_spanned_attr_inner(at.span, at.id, meta),
+                ast::AttrStyle::Outer => attr::mk_spanned_attr_outer(at.span, at.id, meta),
             }
         } else {
             noop_fold_attribute(at, self)