diff options
author | Sergey Parilin <[email protected]> | 2019-05-15 13:35:47 +0100 |
---|---|---|
committer | Sergey Parilin <[email protected]> | 2019-05-15 13:35:47 +0100 |
commit | 993abedd77cf23ce2281b6c8e60cab49ab4fa97e (patch) | |
tree | b8693ce808a9ca2e7eaae5013644a1082fc7bb17 /crates/ra_assists/src/split_import.rs | |
parent | d77175ce28da45960a89811f273b6c614d7a9413 (diff) |
apply T! macro where it is possible
Diffstat (limited to 'crates/ra_assists/src/split_import.rs')
-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 57e0efaf2..881c5ecdc 100644 --- a/crates/ra_assists/src/split_import.rs +++ b/crates/ra_assists/src/split_import.rs | |||
@@ -2,14 +2,15 @@ use std::iter::successors; | |||
2 | 2 | ||
3 | use hir::db::HirDatabase; | 3 | use hir::db::HirDatabase; |
4 | use ra_syntax::{ | 4 | use ra_syntax::{ |
5 | TextUnit, AstNode, SyntaxKind::COLONCOLON, | 5 | T, |
6 | TextUnit, AstNode, | ||
6 | ast, | 7 | ast, |
7 | }; | 8 | }; |
8 | 9 | ||
9 | use crate::{AssistCtx, Assist, AssistId}; | 10 | use crate::{AssistCtx, Assist, AssistId}; |
10 | 11 | ||
11 | pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 12 | pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
12 | let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == COLONCOLON)?; | 13 | let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == T![::])?; |
13 | let path = ast::Path::cast(colon_colon.parent())?; | 14 | let path = ast::Path::cast(colon_colon.parent())?; |
14 | let top_path = successors(Some(path), |it| it.parent_path()).last()?; | 15 | let top_path = successors(Some(path), |it| it.parent_path()).last()?; |
15 | 16 | ||