aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/split_import.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-13 16:25:17 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-13 16:25:17 +0100
commit23b876bc3b00c53ce24b8a99b4f4bf190fc6300e (patch)
tree632767346f695b6a2d547997c452070dc1f39dca /crates/ra_assists/src/split_import.rs
parent8887782c4ab97d22f3d5c10e142407e4371c5c61 (diff)
parent6aae0cf7fa042d51e97c7606cdf3a338f172f7d2 (diff)
Merge #1143
1143: replace usages of `algo::generate` with `iter::successors` from std r=matklad a=Robbepop Implements #1136 Co-authored-by: Robin Freyler <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/split_import.rs')
-rw-r--r--crates/ra_assists/src/split_import.rs5
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 @@
1use std::iter::successors;
2
1use hir::db::HirDatabase; 3use hir::db::HirDatabase;
2use ra_syntax::{ 4use ra_syntax::{
3 TextUnit, AstNode, SyntaxKind::COLONCOLON, 5 TextUnit, AstNode, SyntaxKind::COLONCOLON,
4 ast, 6 ast,
5 algo::generate,
6}; 7};
7 8
8use crate::{AssistCtx, Assist, AssistId}; 9use crate::{AssistCtx, Assist, AssistId};
@@ -10,7 +11,7 @@ use crate::{AssistCtx, Assist, AssistId};
10pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 11pub(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() {