about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/attr
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-11-23 11:55:16 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-02-21 11:51:56 +1100
commit4143b101f9b0949c4bc6db1124f86ef02b1ef7aa (patch)
treeccec1e793829bc4ce4095fc02cc647ba8b6f63f2 /compiler/rustc_ast/src/attr
parent6a56c3a930733b7e000cc3ec54844b0522a8bd16 (diff)
downloadrust-4143b101f9b0949c4bc6db1124f86ef02b1ef7aa.tar.gz
rust-4143b101f9b0949c4bc6db1124f86ef02b1ef7aa.zip
Use `ThinVec` in various AST types.
This commit changes the sequence parsers to produce `ThinVec`, which
triggers numerous conversions.
Diffstat (limited to 'compiler/rustc_ast/src/attr')
-rw-r--r--compiler/rustc_ast/src/attr/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_ast/src/attr/mod.rs b/compiler/rustc_ast/src/attr/mod.rs
index e75d2f77dbb..2e83b3e623f 100644
--- a/compiler/rustc_ast/src/attr/mod.rs
+++ b/compiler/rustc_ast/src/attr/mod.rs
@@ -20,7 +20,7 @@ use std::iter;
 use std::ops::BitXor;
 #[cfg(debug_assertions)]
 use std::sync::atomic::{AtomicU32, Ordering};
-use thin_vec::thin_vec;
+use thin_vec::{thin_vec, ThinVec};
 
 pub struct MarkedAttrs(GrowableBitSet<AttrId>);
 
@@ -135,7 +135,7 @@ impl Attribute {
         }
     }
 
-    pub fn meta_item_list(&self) -> Option<Vec<NestedMetaItem>> {
+    pub fn meta_item_list(&self) -> Option<ThinVec<NestedMetaItem>> {
         match &self.kind {
             AttrKind::Normal(normal) => normal.item.meta_item_list(),
             AttrKind::DocComment(..) => None,
@@ -216,7 +216,7 @@ impl AttrItem {
         self.args.span().map_or(self.path.span, |args_span| self.path.span.to(args_span))
     }
 
-    fn meta_item_list(&self) -> Option<Vec<NestedMetaItem>> {
+    fn meta_item_list(&self) -> Option<ThinVec<NestedMetaItem>> {
         match &self.args {
             AttrArgs::Delimited(args) if args.delim == MacDelimiter::Parenthesis => {
                 MetaItemKind::list_from_tokens(args.tokens.clone())
@@ -375,9 +375,9 @@ impl MetaItemKind {
         }
     }
 
-    fn list_from_tokens(tokens: TokenStream) -> Option<Vec<NestedMetaItem>> {
+    fn list_from_tokens(tokens: TokenStream) -> Option<ThinVec<NestedMetaItem>> {
         let mut tokens = tokens.into_trees().peekable();
-        let mut result = Vec::new();
+        let mut result = ThinVec::new();
         while tokens.peek().is_some() {
             let item = NestedMetaItem::from_tokens(&mut tokens)?;
             result.push(item);