diff --git a/src/attr.rs b/src/attr.rs index 41ba9a847e67a..f5c1ee5fdd121 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -49,10 +49,7 @@ pub(crate) fn get_span_without_attrs(stmt: &ast::Stmt) -> Span { } /// Returns attributes that are within `outer_span`. -pub(crate) fn filter_inline_attrs( - attrs: &[ast::Attribute], - outer_span: Span, -) -> Vec { +pub(crate) fn filter_inline_attrs(attrs: &[ast::Attribute], outer_span: Span) -> ast::AttrVec { attrs .iter() .filter(|a| outer_span.lo() <= a.span.lo() && a.span.hi() <= outer_span.hi()) diff --git a/src/imports.rs b/src/imports.rs index 8d41c881589e5..b6530c69243ed 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -116,7 +116,7 @@ pub(crate) struct UseTree { // Additional fields for top level use items. // Should we have another struct for top-level use items rather than reusing this? visibility: Option, - attrs: Option>, + attrs: Option, } impl PartialEq for UseTree { @@ -417,7 +417,7 @@ impl UseTree { list_item: Option, visibility: Option, opt_lo: Option, - attrs: Option>, + attrs: Option, ) -> UseTree { let span = if let Some(lo) = opt_lo { mk_sp(lo, a.span.hi()) diff --git a/src/modules.rs b/src/modules.rs index 81da724329f02..7a0d1736c59a6 100644 --- a/src/modules.rs +++ b/src/modules.rs @@ -26,7 +26,7 @@ type FileModMap<'ast> = BTreeMap>; pub(crate) struct Module<'a> { ast_mod_kind: Option>, pub(crate) items: Cow<'a, Vec>>, - inner_attr: Vec, + inner_attr: ast::AttrVec, pub(crate) span: Span, } @@ -35,7 +35,7 @@ impl<'a> Module<'a> { mod_span: Span, ast_mod_kind: Option>, mod_items: Cow<'a, Vec>>, - mod_attrs: Cow<'a, Vec>, + mod_attrs: Cow<'a, ast::AttrVec>, ) -> Self { let inner_attr = mod_attrs .iter() @@ -158,7 +158,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> { module_item.item.span, Some(Cow::Owned(sub_mod_kind.clone())), Cow::Owned(vec![]), - Cow::Owned(vec![]), + Cow::Owned(ast::AttrVec::new()), ), )?; } @@ -185,7 +185,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> { span, Some(Cow::Owned(sub_mod_kind.clone())), Cow::Owned(vec![]), - Cow::Owned(vec![]), + Cow::Owned(ast::AttrVec::new()), ), )?; } diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 268c72649a65a..e0bd065518b3d 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -109,7 +109,7 @@ impl<'a> Parser<'a> { sess: &'a ParseSess, path: &Path, span: Span, - ) -> Result<(Vec, Vec>, Span), ParserError> { + ) -> Result<(ast::AttrVec, Vec>, Span), ParserError> { let result = catch_unwind(AssertUnwindSafe(|| { let mut parser = new_parser_from_file(sess.inner(), path, Some(span)); match parser.parse_mod(&TokenKind::Eof) {