diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 13:51:08 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 14:16:05 +0100 |
commit | 1142112c70b705f59b7d559d9d72cdc831865158 (patch) | |
tree | 1ca467302b268c800da8b26482e90effcea08229 /crates/ra_assists/src/handlers/add_missing_impl_members.rs | |
parent | 3e1e6227ca525f8631e0bff2215fa3de1b4f4cc1 (diff) |
Rename FnDef -> Fn
Diffstat (limited to 'crates/ra_assists/src/handlers/add_missing_impl_members.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/add_missing_impl_members.rs | 12 |
1 files changed, 6 insertions, 6 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 a2d9006e4..4f377e37f 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs | |||
@@ -118,7 +118,7 @@ fn add_missing_impl_members_inner( | |||
118 | 118 | ||
119 | let def_name = |item: &ast::AssocItem| -> Option<SmolStr> { | 119 | let def_name = |item: &ast::AssocItem| -> Option<SmolStr> { |
120 | match item { | 120 | match item { |
121 | ast::AssocItem::FnDef(def) => def.name(), | 121 | ast::AssocItem::Fn(def) => def.name(), |
122 | ast::AssocItem::TypeAliasDef(def) => def.name(), | 122 | ast::AssocItem::TypeAliasDef(def) => def.name(), |
123 | ast::AssocItem::ConstDef(def) => def.name(), | 123 | ast::AssocItem::ConstDef(def) => def.name(), |
124 | ast::AssocItem::MacroCall(_) => None, | 124 | ast::AssocItem::MacroCall(_) => None, |
@@ -129,13 +129,13 @@ fn add_missing_impl_members_inner( | |||
129 | let missing_items = get_missing_assoc_items(&ctx.sema, &impl_def) | 129 | let missing_items = get_missing_assoc_items(&ctx.sema, &impl_def) |
130 | .iter() | 130 | .iter() |
131 | .map(|i| match i { | 131 | .map(|i| match i { |
132 | hir::AssocItem::Function(i) => ast::AssocItem::FnDef(i.source(ctx.db()).value), | 132 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value), |
133 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value), | 133 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value), |
134 | hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value), | 134 | hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value), |
135 | }) | 135 | }) |
136 | .filter(|t| def_name(&t).is_some()) | 136 | .filter(|t| def_name(&t).is_some()) |
137 | .filter(|t| match t { | 137 | .filter(|t| match t { |
138 | ast::AssocItem::FnDef(def) => match mode { | 138 | ast::AssocItem::Fn(def) => match mode { |
139 | AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(), | 139 | AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(), |
140 | AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(), | 140 | AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(), |
141 | }, | 141 | }, |
@@ -158,7 +158,7 @@ fn add_missing_impl_members_inner( | |||
158 | .into_iter() | 158 | .into_iter() |
159 | .map(|it| ast_transform::apply(&*ast_transform, it)) | 159 | .map(|it| ast_transform::apply(&*ast_transform, it)) |
160 | .map(|it| match it { | 160 | .map(|it| match it { |
161 | ast::AssocItem::FnDef(def) => ast::AssocItem::FnDef(add_body(def)), | 161 | ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)), |
162 | ast::AssocItem::TypeAliasDef(def) => { | 162 | ast::AssocItem::TypeAliasDef(def) => { |
163 | ast::AssocItem::TypeAliasDef(def.remove_bounds()) | 163 | ast::AssocItem::TypeAliasDef(def.remove_bounds()) |
164 | } | 164 | } |
@@ -174,7 +174,7 @@ fn add_missing_impl_members_inner( | |||
174 | Some(cap) => { | 174 | Some(cap) => { |
175 | let mut cursor = Cursor::Before(first_new_item.syntax()); | 175 | let mut cursor = Cursor::Before(first_new_item.syntax()); |
176 | let placeholder; | 176 | let placeholder; |
177 | if let ast::AssocItem::FnDef(func) = &first_new_item { | 177 | if let ast::AssocItem::Fn(func) = &first_new_item { |
178 | if let Some(m) = func.syntax().descendants().find_map(ast::MacroCall::cast) { | 178 | if let Some(m) = func.syntax().descendants().find_map(ast::MacroCall::cast) { |
179 | if m.syntax().text() == "todo!()" { | 179 | if m.syntax().text() == "todo!()" { |
180 | placeholder = m; | 180 | placeholder = m; |
@@ -192,7 +192,7 @@ fn add_missing_impl_members_inner( | |||
192 | }) | 192 | }) |
193 | } | 193 | } |
194 | 194 | ||
195 | fn add_body(fn_def: ast::FnDef) -> ast::FnDef { | 195 | fn add_body(fn_def: ast::Fn) -> ast::Fn { |
196 | if fn_def.body().is_some() { | 196 | if fn_def.body().is_some() { |
197 | return fn_def; | 197 | return fn_def; |
198 | } | 198 | } |