From f97e896fd669b61051027d76d6dccb89c72c4c52 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 5 Feb 2019 15:11:27 +1100 Subject: Simplify `fold_attribute`. It doesn't need to return an `Option`. --- src/libsyntax/ext/expand.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/libsyntax/ext') 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 { + 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) -- cgit 1.4.1-3-g733a5