diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/flycheck/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_arena/src/map.rs | 10 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 8 | ||||
-rw-r--r-- | crates/vfs/src/file_set.rs | 3 |
4 files changed, 10 insertions, 12 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs index ec769459c..7c38f5ef9 100644 --- a/crates/flycheck/src/lib.rs +++ b/crates/flycheck/src/lib.rs | |||
@@ -106,7 +106,6 @@ struct FlycheckActor { | |||
106 | cargo_handle: Option<CargoHandle>, | 106 | cargo_handle: Option<CargoHandle>, |
107 | } | 107 | } |
108 | 108 | ||
109 | #[allow(clippy::large_enum_variant)] | ||
110 | enum Event { | 109 | enum Event { |
111 | Restart(Restart), | 110 | Restart(Restart), |
112 | CheckEvent(Option<cargo_metadata::Message>), | 111 | CheckEvent(Option<cargo_metadata::Message>), |
diff --git a/crates/ra_arena/src/map.rs b/crates/ra_arena/src/map.rs index c1b58712c..0f33907c0 100644 --- a/crates/ra_arena/src/map.rs +++ b/crates/ra_arena/src/map.rs | |||
@@ -13,18 +13,18 @@ pub struct ArenaMap<ID, V> { | |||
13 | 13 | ||
14 | impl<T, V> ArenaMap<Idx<T>, V> { | 14 | impl<T, V> ArenaMap<Idx<T>, V> { |
15 | pub fn insert(&mut self, id: Idx<T>, t: V) { | 15 | pub fn insert(&mut self, id: Idx<T>, t: V) { |
16 | let idx = Self::into_idx(id); | 16 | let idx = Self::to_idx(id); |
17 | 17 | ||
18 | self.v.resize_with((idx + 1).max(self.v.len()), || None); | 18 | self.v.resize_with((idx + 1).max(self.v.len()), || None); |
19 | self.v[idx] = Some(t); | 19 | self.v[idx] = Some(t); |
20 | } | 20 | } |
21 | 21 | ||
22 | pub fn get(&self, id: Idx<T>) -> Option<&V> { | 22 | pub fn get(&self, id: Idx<T>) -> Option<&V> { |
23 | self.v.get(Self::into_idx(id)).and_then(|it| it.as_ref()) | 23 | self.v.get(Self::to_idx(id)).and_then(|it| it.as_ref()) |
24 | } | 24 | } |
25 | 25 | ||
26 | pub fn get_mut(&mut self, id: Idx<T>) -> Option<&mut V> { | 26 | pub fn get_mut(&mut self, id: Idx<T>) -> Option<&mut V> { |
27 | self.v.get_mut(Self::into_idx(id)).and_then(|it| it.as_mut()) | 27 | self.v.get_mut(Self::to_idx(id)).and_then(|it| it.as_mut()) |
28 | } | 28 | } |
29 | 29 | ||
30 | pub fn values(&self) -> impl Iterator<Item = &V> { | 30 | pub fn values(&self) -> impl Iterator<Item = &V> { |
@@ -39,7 +39,7 @@ impl<T, V> ArenaMap<Idx<T>, V> { | |||
39 | self.v.iter().enumerate().filter_map(|(idx, o)| Some((Self::from_idx(idx), o.as_ref()?))) | 39 | self.v.iter().enumerate().filter_map(|(idx, o)| Some((Self::from_idx(idx), o.as_ref()?))) |
40 | } | 40 | } |
41 | 41 | ||
42 | fn into_idx(id: Idx<T>) -> usize { | 42 | fn to_idx(id: Idx<T>) -> usize { |
43 | u32::from(id.into_raw()) as usize | 43 | u32::from(id.into_raw()) as usize |
44 | } | 44 | } |
45 | 45 | ||
@@ -51,7 +51,7 @@ impl<T, V> ArenaMap<Idx<T>, V> { | |||
51 | impl<T, V> std::ops::Index<Idx<V>> for ArenaMap<Idx<V>, T> { | 51 | impl<T, V> std::ops::Index<Idx<V>> for ArenaMap<Idx<V>, T> { |
52 | type Output = T; | 52 | type Output = T; |
53 | fn index(&self, id: Idx<V>) -> &T { | 53 | fn index(&self, id: Idx<V>) -> &T { |
54 | self.v[Self::into_idx(id)].as_ref().unwrap() | 54 | self.v[Self::to_idx(id)].as_ref().unwrap() |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index ca6569c9f..0b01d3bc6 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -243,10 +243,12 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { | |||
243 | // test lambda_ret_block | 243 | // test lambda_ret_block |
244 | // fn main() { || -> i32 { 92 }(); } | 244 | // fn main() { || -> i32 { 92 }(); } |
245 | block_expr(p); | 245 | block_expr(p); |
246 | } else if p.at_ts(EXPR_FIRST) { | ||
247 | expr(p); | ||
248 | } else { | 246 | } else { |
249 | p.error("expected expression"); | 247 | if p.at_ts(EXPR_FIRST) { |
248 | expr(p); | ||
249 | } else { | ||
250 | p.error("expected expression"); | ||
251 | } | ||
250 | } | 252 | } |
251 | m.complete(p, CLOSURE_EXPR) | 253 | m.complete(p, CLOSURE_EXPR) |
252 | } | 254 | } |
diff --git a/crates/vfs/src/file_set.rs b/crates/vfs/src/file_set.rs index 9f11268ee..e9196fcd2 100644 --- a/crates/vfs/src/file_set.rs +++ b/crates/vfs/src/file_set.rs | |||
@@ -19,9 +19,6 @@ impl FileSet { | |||
19 | pub fn len(&self) -> usize { | 19 | pub fn len(&self) -> usize { |
20 | self.files.len() | 20 | self.files.len() |
21 | } | 21 | } |
22 | pub fn is_empty(&self) -> bool { | ||
23 | self.len() == 0 | ||
24 | } | ||
25 | pub fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { | 22 | pub fn resolve_path(&self, anchor: FileId, path: &str) -> Option<FileId> { |
26 | let mut base = self.paths[&anchor].clone(); | 23 | let mut base = self.paths[&anchor].clone(); |
27 | base.pop(); | 24 | base.pop(); |