diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_assists/src/fill_match_arms.rs | 31 | ||||
-rw-r--r-- | crates/ra_assists/src/split_import.rs | 5 | ||||
-rw-r--r-- | crates/ra_db/src/input.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/validation/unescape.rs | 2 |
6 files changed, 22 insertions, 27 deletions
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs index d51010b84..deef166b5 100644 --- a/crates/ra_assists/src/fill_match_arms.rs +++ b/crates/ra_assists/src/fill_match_arms.rs | |||
@@ -23,27 +23,24 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As | |||
23 | // We already have some match arms, so we don't provide any assists. | 23 | // We already have some match arms, so we don't provide any assists. |
24 | // Unless if there is only one trivial match arm possibly created | 24 | // Unless if there is only one trivial match arm possibly created |
25 | // by match postfix complete. Trivial match arm is the catch all arm. | 25 | // by match postfix complete. Trivial match arm is the catch all arm. |
26 | match match_expr.match_arm_list() { | 26 | if let Some(arm_list) = match_expr.match_arm_list() { |
27 | Some(arm_list) => { | 27 | let mut arm_iter = arm_list.arms(); |
28 | let mut arm_iter = arm_list.arms(); | 28 | let first = arm_iter.next(); |
29 | let first = arm_iter.next(); | 29 | |
30 | 30 | match first { | |
31 | match first { | 31 | // If there arm list is empty or there is only one trivial arm, then proceed. |
32 | // If there arm list is empty or there is only one trivial arm, then proceed. | 32 | Some(arm) if is_trivial_arm(arm) => { |
33 | Some(arm) if is_trivial_arm(arm) => { | 33 | if arm_iter.next() != None { |
34 | if arm_iter.next() != None { | ||
35 | return None; | ||
36 | } | ||
37 | } | ||
38 | None => {} | ||
39 | |||
40 | _ => { | ||
41 | return None; | 34 | return None; |
42 | } | 35 | } |
43 | } | 36 | } |
37 | None => {} | ||
38 | |||
39 | _ => { | ||
40 | return None; | ||
41 | } | ||
44 | } | 42 | } |
45 | _ => {} | 43 | }; |
46 | } | ||
47 | 44 | ||
48 | let expr = match_expr.expr()?; | 45 | let expr = match_expr.expr()?; |
49 | let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax(), None); | 46 | let analyzer = hir::SourceAnalyzer::new(ctx.db, ctx.frange.file_id, expr.syntax(), None); |
diff --git a/crates/ra_assists/src/split_import.rs b/crates/ra_assists/src/split_import.rs index a8feb67c8..99088d9a5 100644 --- a/crates/ra_assists/src/split_import.rs +++ b/crates/ra_assists/src/split_import.rs | |||
@@ -10,10 +10,7 @@ pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assis | |||
10 | let path = ast::Path::cast(colon_colon.parent())?; | 10 | let path = ast::Path::cast(colon_colon.parent())?; |
11 | let top_path = successors(Some(path), |it| it.parent_path()).last()?; | 11 | let top_path = successors(Some(path), |it| it.parent_path()).last()?; |
12 | 12 | ||
13 | let use_tree = top_path.syntax().ancestors().find_map(ast::UseTree::cast); | 13 | let _use_tree = top_path.syntax().ancestors().find_map(ast::UseTree::cast)?; |
14 | if use_tree.is_none() { | ||
15 | return None; | ||
16 | } | ||
17 | 14 | ||
18 | let l_curly = colon_colon.range().end(); | 15 | let l_curly = colon_colon.range().end(); |
19 | let r_curly = match top_path.syntax().parent().and_then(ast::UseTree::cast) { | 16 | let r_curly = match top_path.syntax().parent().and_then(ast::UseTree::cast) { |
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs index 2d563bd01..ad8e10c52 100644 --- a/crates/ra_db/src/input.rs +++ b/crates/ra_db/src/input.rs | |||
@@ -131,7 +131,8 @@ impl CrateGraph { | |||
131 | if self.dfs_find(from, to, &mut FxHashSet::default()) { | 131 | if self.dfs_find(from, to, &mut FxHashSet::default()) { |
132 | return Err(CyclicDependencies); | 132 | return Err(CyclicDependencies); |
133 | } | 133 | } |
134 | Ok(self.arena.get_mut(&from).unwrap().add_dep(name, to)) | 134 | self.arena.get_mut(&from).unwrap().add_dep(name, to); |
135 | Ok(()) | ||
135 | } | 136 | } |
136 | 137 | ||
137 | pub fn is_empty(&self) -> bool { | 138 | pub fn is_empty(&self) -> bool { |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index ed640d7fc..b3a4f4d63 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -240,10 +240,10 @@ impl Module { | |||
240 | } | 240 | } |
241 | 241 | ||
242 | pub fn path_to_root(self, db: &impl HirDatabase) -> Vec<Module> { | 242 | pub fn path_to_root(self, db: &impl HirDatabase) -> Vec<Module> { |
243 | let mut res = vec![self.clone()]; | 243 | let mut res = vec![self]; |
244 | let mut curr = self.clone(); | 244 | let mut curr = self; |
245 | while let Some(next) = curr.parent(db) { | 245 | while let Some(next) = curr.parent(db) { |
246 | res.push(next.clone()); | 246 | res.push(next); |
247 | curr = next | 247 | curr = next |
248 | } | 248 | } |
249 | res | 249 | res |
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 9228dd314..78aa76449 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -529,7 +529,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
529 | match matching_def { | 529 | match matching_def { |
530 | Some(_) => { | 530 | Some(_) => { |
531 | self.write_assoc_resolution(id, item); | 531 | self.write_assoc_resolution(id, item); |
532 | return matching_def; | 532 | matching_def |
533 | } | 533 | } |
534 | None => None, | 534 | None => None, |
535 | } | 535 | } |
diff --git a/crates/ra_syntax/src/validation/unescape.rs b/crates/ra_syntax/src/validation/unescape.rs index 1cb2433f3..7eed6c663 100644 --- a/crates/ra_syntax/src/validation/unescape.rs +++ b/crates/ra_syntax/src/validation/unescape.rs | |||
@@ -262,7 +262,7 @@ where | |||
262 | 262 | ||
263 | fn byte_from_char(c: char) -> u8 { | 263 | fn byte_from_char(c: char) -> u8 { |
264 | let res = c as u32; | 264 | let res = c as u32; |
265 | assert!(res <= u8::max_value() as u32, "guaranteed because of Mode::Byte"); | 265 | assert!(res <= u32::from(u8::max_value()), "guaranteed because of Mode::Byte"); |
266 | res as u8 | 266 | res as u8 |
267 | } | 267 | } |
268 | 268 | ||