aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2021-03-25 19:03:20 +0000
committerLaurenČ›iu Nicola <[email protected]>2021-03-25 19:03:20 +0000
commit9787bddac577a6aa24388fb91286474a7a8cf0bc (patch)
tree2549ec113b23c88ac95fe4eee2e59f8e95297465 /crates
parent59fdd7c84c5fdc16573f3cca4081d6735eaa9208 (diff)
Use arrayvec 0.6
Diffstat (limited to 'crates')
-rw-r--r--crates/hir/Cargo.toml2
-rw-r--r--crates/hir/src/lib.rs2
-rw-r--r--crates/hir_ty/Cargo.toml2
-rw-r--r--crates/hir_ty/src/display.rs6
-rw-r--r--crates/hir_ty/src/method_resolution.rs4
-rw-r--r--crates/syntax/Cargo.toml2
-rw-r--r--crates/syntax/src/ast/edit.rs16
7 files changed, 16 insertions, 18 deletions
diff --git a/crates/hir/Cargo.toml b/crates/hir/Cargo.toml
index 55e9c3f0c..2ef5bcbc9 100644
--- a/crates/hir/Cargo.toml
+++ b/crates/hir/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
13log = "0.4.8" 13log = "0.4.8"
14rustc-hash = "1.1.0" 14rustc-hash = "1.1.0"
15either = "1.5.3" 15either = "1.5.3"
16arrayvec = "0.5.1" 16arrayvec = "0.6"
17itertools = "0.10.0" 17itertools = "0.10.0"
18smallvec = "1.4.0" 18smallvec = "1.4.0"
19 19
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 6fa676c4d..05a60e158 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -2238,7 +2238,7 @@ pub enum ScopeDef {
2238} 2238}
2239 2239
2240impl ScopeDef { 2240impl ScopeDef {
2241 pub fn all_items(def: PerNs) -> ArrayVec<[Self; 3]> { 2241 pub fn all_items(def: PerNs) -> ArrayVec<Self, 3> {
2242 let mut items = ArrayVec::new(); 2242 let mut items = ArrayVec::new();
2243 2243
2244 match (def.take_types(), def.take_values()) { 2244 match (def.take_types(), def.take_values()) {
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml
index 0ef27cd37..030b7eebe 100644
--- a/crates/hir_ty/Cargo.toml
+++ b/crates/hir_ty/Cargo.toml
@@ -12,7 +12,7 @@ doctest = false
12[dependencies] 12[dependencies]
13cov-mark = { version = "1.1", features = ["thread-local"] } 13cov-mark = { version = "1.1", features = ["thread-local"] }
14itertools = "0.10.0" 14itertools = "0.10.0"
15arrayvec = "0.5.1" 15arrayvec = "0.6"
16smallvec = "1.2.0" 16smallvec = "1.2.0"
17ena = "0.14.0" 17ena = "0.14.0"
18log = "0.4.8" 18log = "0.4.8"
diff --git a/crates/hir_ty/src/display.rs b/crates/hir_ty/src/display.rs
index 6149067c7..51480304b 100644
--- a/crates/hir_ty/src/display.rs
+++ b/crates/hir_ty/src/display.rs
@@ -1,8 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use std::fmt; 3use std::{array, fmt};
4 4
5use arrayvec::ArrayVec;
6use chalk_ir::Mutability; 5use chalk_ir::Mutability;
7use hir_def::{ 6use hir_def::{
8 db::DefDatabase, 7 db::DefDatabase,
@@ -669,8 +668,7 @@ fn fn_traits(db: &dyn DefDatabase, trait_: TraitId) -> impl Iterator<Item = Trai
669 db.lang_item(krate, "fn_mut".into()), 668 db.lang_item(krate, "fn_mut".into()),
670 db.lang_item(krate, "fn_once".into()), 669 db.lang_item(krate, "fn_once".into()),
671 ]; 670 ];
672 // FIXME: Replace ArrayVec when into_iter is a thing on arrays 671 array::IntoIter::new(fn_traits).into_iter().flatten().flat_map(|it| it.as_trait())
673 ArrayVec::from(fn_traits).into_iter().flatten().flat_map(|it| it.as_trait())
674} 672}
675 673
676pub fn write_bounds_like_dyn_trait_with_prefix( 674pub fn write_bounds_like_dyn_trait_with_prefix(
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs
index 84d9a1e18..bf7d5eded 100644
--- a/crates/hir_ty/src/method_resolution.rs
+++ b/crates/hir_ty/src/method_resolution.rs
@@ -228,12 +228,12 @@ impl Ty {
228 &self, 228 &self,
229 db: &dyn HirDatabase, 229 db: &dyn HirDatabase,
230 cur_crate: CrateId, 230 cur_crate: CrateId,
231 ) -> Option<ArrayVec<[CrateId; 2]>> { 231 ) -> Option<ArrayVec<CrateId, 2>> {
232 // Types like slice can have inherent impls in several crates, (core and alloc). 232 // Types like slice can have inherent impls in several crates, (core and alloc).
233 // The corresponding impls are marked with lang items, so we can use them to find the required crates. 233 // The corresponding impls are marked with lang items, so we can use them to find the required crates.
234 macro_rules! lang_item_crate { 234 macro_rules! lang_item_crate {
235 ($($name:expr),+ $(,)?) => {{ 235 ($($name:expr),+ $(,)?) => {{
236 let mut v = ArrayVec::<[LangItemTarget; 2]>::new(); 236 let mut v = ArrayVec::<LangItemTarget, 2>::new();
237 $( 237 $(
238 v.extend(db.lang_item(cur_crate, $name.into())); 238 v.extend(db.lang_item(cur_crate, $name.into()));
239 )+ 239 )+
diff --git a/crates/syntax/Cargo.toml b/crates/syntax/Cargo.toml
index 0c3fec3c7..9f01acc26 100644
--- a/crates/syntax/Cargo.toml
+++ b/crates/syntax/Cargo.toml
@@ -16,7 +16,7 @@ itertools = "0.10.0"
16rowan = "0.13.0-pre.3" 16rowan = "0.13.0-pre.3"
17rustc_lexer = { version = "710.0.0", package = "rustc-ap-rustc_lexer" } 17rustc_lexer = { version = "710.0.0", package = "rustc-ap-rustc_lexer" }
18rustc-hash = "1.1.0" 18rustc-hash = "1.1.0"
19arrayvec = "0.5.1" 19arrayvec = "0.6"
20once_cell = "1.3.1" 20once_cell = "1.3.1"
21indexmap = "1.4.0" 21indexmap = "1.4.0"
22smol_str = { version = "0.1.15", features = ["serde"] } 22smol_str = { version = "0.1.15", features = ["serde"] }
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs
index 18820786a..2d1d08fba 100644
--- a/crates/syntax/src/ast/edit.rs
+++ b/crates/syntax/src/ast/edit.rs
@@ -32,7 +32,7 @@ impl ast::BinExpr {
32impl ast::Fn { 32impl ast::Fn {
33 #[must_use] 33 #[must_use]
34 pub fn with_body(&self, body: ast::BlockExpr) -> ast::Fn { 34 pub fn with_body(&self, body: ast::BlockExpr) -> ast::Fn {
35 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); 35 let mut to_insert: ArrayVec<SyntaxElement, 2> = ArrayVec::new();
36 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { 36 let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
37 old_body.syntax().clone().into() 37 old_body.syntax().clone().into()
38 } else if let Some(semi) = self.semicolon_token() { 38 } else if let Some(semi) = self.semicolon_token() {
@@ -55,7 +55,7 @@ impl ast::Fn {
55 55
56 let anchor = self.name().expect("The function must have a name").syntax().clone(); 56 let anchor = self.name().expect("The function must have a name").syntax().clone();
57 57
58 let mut to_insert: ArrayVec<[SyntaxElement; 1]> = ArrayVec::new(); 58 let mut to_insert: ArrayVec<SyntaxElement, 1> = ArrayVec::new();
59 to_insert.push(generic_args.syntax().clone().into()); 59 to_insert.push(generic_args.syntax().clone().into());
60 self.insert_children(InsertPosition::After(anchor.into()), to_insert) 60 self.insert_children(InsertPosition::After(anchor.into()), to_insert)
61 } 61 }
@@ -96,7 +96,7 @@ where
96impl ast::Impl { 96impl ast::Impl {
97 #[must_use] 97 #[must_use]
98 pub fn with_assoc_item_list(&self, items: ast::AssocItemList) -> ast::Impl { 98 pub fn with_assoc_item_list(&self, items: ast::AssocItemList) -> ast::Impl {
99 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); 99 let mut to_insert: ArrayVec<SyntaxElement, 2> = ArrayVec::new();
100 if let Some(old_items) = self.assoc_item_list() { 100 if let Some(old_items) = self.assoc_item_list() {
101 let to_replace: SyntaxElement = old_items.syntax().clone().into(); 101 let to_replace: SyntaxElement = old_items.syntax().clone().into();
102 to_insert.push(items.syntax().clone().into()); 102 to_insert.push(items.syntax().clone().into());
@@ -141,7 +141,7 @@ impl ast::AssocItemList {
141 }, 141 },
142 }; 142 };
143 let ws = tokens::WsBuilder::new(&format!("{}{}", whitespace, indent)); 143 let ws = tokens::WsBuilder::new(&format!("{}{}", whitespace, indent));
144 let to_insert: ArrayVec<[SyntaxElement; 2]> = 144 let to_insert: ArrayVec<SyntaxElement, 2> =
145 [ws.ws().into(), item.syntax().clone().into()].into(); 145 [ws.ws().into(), item.syntax().clone().into()].into();
146 self.insert_children(position, to_insert) 146 self.insert_children(position, to_insert)
147 } 147 }
@@ -192,7 +192,7 @@ impl ast::RecordExprFieldList {
192 tokens::single_space() 192 tokens::single_space()
193 }; 193 };
194 194
195 let mut to_insert: ArrayVec<[SyntaxElement; 4]> = ArrayVec::new(); 195 let mut to_insert: ArrayVec<SyntaxElement, 4> = ArrayVec::new();
196 to_insert.push(space.into()); 196 to_insert.push(space.into());
197 to_insert.push(field.syntax().clone().into()); 197 to_insert.push(field.syntax().clone().into());
198 to_insert.push(make::token(T![,]).into()); 198 to_insert.push(make::token(T![,]).into());
@@ -305,7 +305,7 @@ impl ast::PathSegment {
305 iter::once(type_args.syntax().clone().into()), 305 iter::once(type_args.syntax().clone().into()),
306 ); 306 );
307 } 307 }
308 let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); 308 let mut to_insert: ArrayVec<SyntaxElement, 2> = ArrayVec::new();
309 if turbo { 309 if turbo {
310 to_insert.push(make::token(T![::]).into()); 310 to_insert.push(make::token(T![::]).into());
311 } 311 }
@@ -444,7 +444,7 @@ impl ast::MatchArmList {
444 let arm_ws = tokens::WsBuilder::new(" "); 444 let arm_ws = tokens::WsBuilder::new(" ");
445 let match_indent = &leading_indent(self.syntax()).unwrap_or_default(); 445 let match_indent = &leading_indent(self.syntax()).unwrap_or_default();
446 let match_ws = tokens::WsBuilder::new(&format!("\n{}", match_indent)); 446 let match_ws = tokens::WsBuilder::new(&format!("\n{}", match_indent));
447 let to_insert: ArrayVec<[SyntaxElement; 3]> = 447 let to_insert: ArrayVec<SyntaxElement, 3> =
448 [arm_ws.ws().into(), item.syntax().clone().into(), match_ws.ws().into()].into(); 448 [arm_ws.ws().into(), item.syntax().clone().into(), match_ws.ws().into()].into();
449 self.insert_children(position, to_insert) 449 self.insert_children(position, to_insert)
450 } 450 }
@@ -465,7 +465,7 @@ impl ast::GenericParamList {
465 pub fn append_param(&self, item: ast::GenericParam) -> ast::GenericParamList { 465 pub fn append_param(&self, item: ast::GenericParam) -> ast::GenericParamList {
466 let space = tokens::single_space(); 466 let space = tokens::single_space();
467 467
468 let mut to_insert: ArrayVec<[SyntaxElement; 4]> = ArrayVec::new(); 468 let mut to_insert: ArrayVec<SyntaxElement, 4> = ArrayVec::new();
469 if self.generic_params().next().is_some() { 469 if self.generic_params().next().is_some() {
470 to_insert.push(space.into()); 470 to_insert.push(space.into());
471 } 471 }