From 7e2bca4ec356655fe47d50b466c34c34e7cae565 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 19 Mar 2020 12:36:33 +0100 Subject: [PATCH] Cleanup imports --- crates/ra_assists/src/handlers/add_custom_impl.rs | 4 ++-- crates/ra_assists/src/handlers/add_impl.rs | 1 - crates/ra_assists/src/handlers/add_new.rs | 3 ++- crates/ra_assists/src/handlers/auto_import.rs | 14 ++++++++------ crates/ra_assists/src/handlers/fill_match_arms.rs | 2 +- crates/ra_assists/src/handlers/invert_if.rs | 6 ++++-- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs index 74aa4b0016..dd2bed25a8 100644 --- a/crates/ra_assists/src/handlers/add_custom_impl.rs +++ b/crates/ra_assists/src/handlers/add_custom_impl.rs @@ -1,7 +1,5 @@ //! FIXME: write short doc here -use crate::{Assist, AssistCtx, AssistId}; - use join_to_string::join; use ra_syntax::{ ast::{self, AstNode}, @@ -10,6 +8,8 @@ use ra_syntax::{ TextRange, TextUnit, }; +use crate::{Assist, AssistCtx, AssistId}; + const DERIVE_TRAIT: &str = "derive"; // Assist: add_custom_impl diff --git a/crates/ra_assists/src/handlers/add_impl.rs b/crates/ra_assists/src/handlers/add_impl.rs index 241b085fd2..afae7d3850 100644 --- a/crates/ra_assists/src/handlers/add_impl.rs +++ b/crates/ra_assists/src/handlers/add_impl.rs @@ -1,5 +1,4 @@ use format_buf::format; - use join_to_string::join; use ra_syntax::{ ast::{self, AstNode, NameOwner, TypeParamsOwner}, diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs index 697e7cda65..729a223e0e 100644 --- a/crates/ra_assists/src/handlers/add_new.rs +++ b/crates/ra_assists/src/handlers/add_new.rs @@ -1,3 +1,5 @@ +use std::fmt::Write; + use format_buf::format; use hir::Adt; use join_to_string::join; @@ -7,7 +9,6 @@ use ra_syntax::{ }, TextUnit, T, }; -use std::fmt::Write; use crate::{Assist, AssistCtx, AssistId}; diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 4b62aac486..bb280f633d 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs @@ -1,8 +1,5 @@ -use crate::{ - assist_ctx::{Assist, AssistCtx}, - utils::insert_use_statement, - AssistId, -}; +use std::collections::BTreeSet; + use hir::{ AsAssocItem, AssocItemContainer, ModPath, Module, ModuleDef, PathResolution, Semantics, Trait, Type, @@ -14,7 +11,12 @@ use ra_syntax::{ SyntaxNode, }; use rustc_hash::FxHashSet; -use std::collections::BTreeSet; + +use crate::{ + assist_ctx::{Assist, AssistCtx}, + utils::insert_use_statement, + AssistId, +}; // Assist: auto_import // diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index 97cf90ae42..a1e4c2eb75 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs @@ -3,10 +3,10 @@ use std::iter; use hir::{Adt, HasSource, Semantics}; +use ra_ide_db::RootDatabase; use ra_syntax::ast::{self, edit::IndentLevel, make, AstNode, NameOwner}; use crate::{Assist, AssistCtx, AssistId}; -use ra_ide_db::RootDatabase; // Assist: fill_match_arms // diff --git a/crates/ra_assists/src/handlers/invert_if.rs b/crates/ra_assists/src/handlers/invert_if.rs index a594e7e0c3..3a2665d172 100644 --- a/crates/ra_assists/src/handlers/invert_if.rs +++ b/crates/ra_assists/src/handlers/invert_if.rs @@ -1,5 +1,7 @@ -use ra_syntax::ast::{self, AstNode}; -use ra_syntax::T; +use ra_syntax::{ + ast::{self, AstNode}, + T, +}; use crate::{utils::invert_boolean_expression, Assist, AssistCtx, AssistId};