diff options
author | Robin Freyler <[email protected]> | 2019-04-13 15:43:49 +0100 |
---|---|---|
committer | Robin Freyler <[email protected]> | 2019-04-13 15:43:49 +0100 |
commit | 6aae0cf7fa042d51e97c7606cdf3a338f172f7d2 (patch) | |
tree | 632767346f695b6a2d547997c452070dc1f39dca /crates/ra_assists/src | |
parent | 8887782c4ab97d22f3d5c10e142407e4371c5c61 (diff) |
replace usages of `algo::generate` with `iter::successors` from std
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/split_import.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_assists/src/split_import.rs b/crates/ra_assists/src/split_import.rs index 4bf1852db..57e0efaf2 100644 --- a/crates/ra_assists/src/split_import.rs +++ b/crates/ra_assists/src/split_import.rs | |||
@@ -1,8 +1,9 @@ | |||
1 | use std::iter::successors; | ||
2 | |||
1 | use hir::db::HirDatabase; | 3 | use hir::db::HirDatabase; |
2 | use ra_syntax::{ | 4 | use ra_syntax::{ |
3 | TextUnit, AstNode, SyntaxKind::COLONCOLON, | 5 | TextUnit, AstNode, SyntaxKind::COLONCOLON, |
4 | ast, | 6 | ast, |
5 | algo::generate, | ||
6 | }; | 7 | }; |
7 | 8 | ||
8 | use crate::{AssistCtx, Assist, AssistId}; | 9 | use crate::{AssistCtx, Assist, AssistId}; |
@@ -10,7 +11,7 @@ use crate::{AssistCtx, Assist, AssistId}; | |||
10 | pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 11 | pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
11 | let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == COLONCOLON)?; | 12 | let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == COLONCOLON)?; |
12 | let path = ast::Path::cast(colon_colon.parent())?; | 13 | let path = ast::Path::cast(colon_colon.parent())?; |
13 | let top_path = generate(Some(path), |it| it.parent_path()).last()?; | 14 | let top_path = successors(Some(path), |it| it.parent_path()).last()?; |
14 | 15 | ||
15 | let use_tree = top_path.syntax().ancestors().find_map(ast::UseTree::cast); | 16 | let use_tree = top_path.syntax().ancestors().find_map(ast::UseTree::cast); |
16 | if use_tree.is_none() { | 17 | if use_tree.is_none() { |