diff options
author | Kevin DeLorey <[email protected]> | 2020-02-11 15:40:08 +0000 |
---|---|---|
committer | Kevin DeLorey <[email protected]> | 2020-02-11 15:40:08 +0000 |
commit | 3aaf46afa13b6fcbfdc36d8eb0cce48196d824a7 (patch) | |
tree | a178742f62144801bd70bac21dc090923e1ced9c /crates/ra_assists/src | |
parent | d7e36c3dd2b601401feb86bef3c0f8bb62fb4331 (diff) |
Formatted changes.
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/handlers/add_missing_impl_members.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/utils.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs index 4c937b154..ab21388c8 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs | |||
@@ -6,8 +6,8 @@ use ra_syntax::{ | |||
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | ast_transform::{self, AstTransform, QualifyPaths, SubstituteTypeParams}, | 8 | ast_transform::{self, AstTransform, QualifyPaths, SubstituteTypeParams}, |
9 | Assist, AssistCtx, AssistId, | ||
10 | utils::{get_missing_impl_items, resolve_target_trait}, | 9 | utils::{get_missing_impl_items, resolve_target_trait}, |
10 | Assist, AssistCtx, AssistId, | ||
11 | }; | 11 | }; |
12 | 12 | ||
13 | #[derive(PartialEq)] | 13 | #[derive(PartialEq)] |
@@ -129,7 +129,7 @@ fn add_missing_impl_members_inner( | |||
129 | ast::ImplItem::FnDef(def) => match mode { | 129 | ast::ImplItem::FnDef(def) => match mode { |
130 | AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(), | 130 | AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(), |
131 | AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(), | 131 | AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(), |
132 | } | 132 | }, |
133 | _ => mode == AddMissingImplMembersMode::NoDefaultMethods, | 133 | _ => mode == AddMissingImplMembersMode::NoDefaultMethods, |
134 | }) | 134 | }) |
135 | .collect::<Vec<_>>(); | 135 | .collect::<Vec<_>>(); |
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index 7628933fb..461f01536 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -9,14 +9,13 @@ use hir::db::HirDatabase; | |||
9 | 9 | ||
10 | use rustc_hash::FxHashSet; | 10 | use rustc_hash::FxHashSet; |
11 | 11 | ||
12 | /// Generate a collection of associated items that are missing from a | 12 | /// Generate a collection of associated items that are missing from a |
13 | /// `impl Trait for` block. | 13 | /// `impl Trait for` block. |
14 | pub fn get_missing_impl_items( | 14 | pub fn get_missing_impl_items( |
15 | db: &impl HirDatabase, | 15 | db: &impl HirDatabase, |
16 | analyzer: &hir::SourceAnalyzer, | 16 | analyzer: &hir::SourceAnalyzer, |
17 | impl_block: &ast::ImplBlock, | 17 | impl_block: &ast::ImplBlock, |
18 | ) -> Vec<hir::AssocItem> { | 18 | ) -> Vec<hir::AssocItem> { |
19 | |||
20 | // Names must be unique between constants and functions. However, type aliases | 19 | // Names must be unique between constants and functions. However, type aliases |
21 | // may share the same name as a function or constant. | 20 | // may share the same name as a function or constant. |
22 | let mut impl_fns_consts = FxHashSet::default(); | 21 | let mut impl_fns_consts = FxHashSet::default(); |
@@ -53,9 +52,10 @@ pub fn get_missing_impl_items( | |||
53 | .filter(|i| match i { | 52 | .filter(|i| match i { |
54 | hir::AssocItem::Function(f) => !impl_fns_consts.contains(&f.name(db).to_string()), | 53 | hir::AssocItem::Function(f) => !impl_fns_consts.contains(&f.name(db).to_string()), |
55 | hir::AssocItem::TypeAlias(t) => !impl_type.contains(&t.name(db).to_string()), | 54 | hir::AssocItem::TypeAlias(t) => !impl_type.contains(&t.name(db).to_string()), |
56 | hir::AssocItem::Const(c) => { | 55 | hir::AssocItem::Const(c) => c |
57 | c.name(db).map(|n| !impl_fns_consts.contains(&n.to_string())).unwrap_or_default() | 56 | .name(db) |
58 | } | 57 | .map(|n| !impl_fns_consts.contains(&n.to_string())) |
58 | .unwrap_or_default(), | ||
59 | }) | 59 | }) |
60 | .map(|i| i.clone()) | 60 | .map(|i| i.clone()) |
61 | .collect() | 61 | .collect() |