Repository: rust-analyzer/rust-analyzer
Pull request #1486 (2019-07-04 20:09:17)

allow rustfmt to reorder imports


Patch:
diff --git a/crates/gen_lsp_server/examples/01_gen_lsp_server.rs b/crates/gen_lsp_server/examples/01_gen_lsp_server.rs
index bc497f74a1..f499650649 100644
--- a/crates/gen_lsp_server/examples/01_gen_lsp_server.rs
+++ b/crates/gen_lsp_server/examples/01_gen_lsp_server.rs
@@ -1,11 +1,11 @@
 use std::error::Error;
 
-use crossbeam_channel::{Sender, Receiver};
+use crossbeam_channel::{Receiver, Sender};
+use gen_lsp_server::{handle_shutdown, run_server, stdio_transport, RawMessage, RawResponse};
 use lsp_types::{
-    ServerCapabilities, InitializeParams,
     request::{GotoDefinition, GotoDefinitionResponse},
+    InitializeParams, ServerCapabilities,
 };
-use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse};
 
 fn main() -> Result<(), Box<dyn Error + Sync + Send>> {
     let (receiver, sender, io_threads) = stdio_transport();
diff --git a/crates/gen_lsp_server/examples/02_gen_lsp_server_with_logging.rs b/crates/gen_lsp_server/examples/02_gen_lsp_server_with_logging.rs
index 1a6174462c..3c48106c5f 100644
--- a/crates/gen_lsp_server/examples/02_gen_lsp_server_with_logging.rs
+++ b/crates/gen_lsp_server/examples/02_gen_lsp_server_with_logging.rs
@@ -44,14 +44,14 @@
 
 use std::error::Error;
 
-use crossbeam_channel::{Sender, Receiver};
-use lsp_types::{
-    ServerCapabilities, InitializeParams,
-    request::{GotoDefinition, GotoDefinitionResponse},
+use crossbeam_channel::{Receiver, Sender};
+use gen_lsp_server::{
+    handle_shutdown, run_server, stdio_transport, RawMessage, RawRequest, RawResponse,
 };
 use log::info;
-use gen_lsp_server::{
-    run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse, RawRequest,
+use lsp_types::{
+    request::{GotoDefinition, GotoDefinitionResponse},
+    InitializeParams, ServerCapabilities,
 };
 
 fn main() -> Result<(), Box<dyn Error + Sync + Send>> {
diff --git a/crates/ra_arena/src/lib.rs b/crates/ra_arena/src/lib.rs
index 26641e6903..3b7cb77b18 100644
--- a/crates/ra_arena/src/lib.rs
+++ b/crates/ra_arena/src/lib.rs
@@ -2,9 +2,9 @@
 
 use std::{
     fmt,
+    iter::FromIterator,
     marker::PhantomData,
     ops::{Index, IndexMut},
-    iter::FromIterator,
 };
 
 pub mod map;
diff --git a/crates/ra_assists/src/add_derive.rs b/crates/ra_assists/src/add_derive.rs
index 0c4cf26150..bf7d55d6d1 100644
--- a/crates/ra_assists/src/add_derive.rs
+++ b/crates/ra_assists/src/add_derive.rs
@@ -1,11 +1,11 @@
 use hir::db::HirDatabase;
 use ra_syntax::{
     ast::{self, AstNode, AttrsOwner},
-    SyntaxKind::{WHITESPACE, COMMENT},
+    SyntaxKind::{COMMENT, WHITESPACE},
     TextUnit,
 };
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let nominal = ctx.node_at_offset::<ast::NominalDef>()?;
diff --git a/crates/ra_assists/src/add_explicit_type.rs b/crates/ra_assists/src/add_explicit_type.rs
index f3ed74b7fb..bb47a32f0a 100644
--- a/crates/ra_assists/src/add_explicit_type.rs
+++ b/crates/ra_assists/src/add_explicit_type.rs
@@ -1,13 +1,10 @@
-use hir::{
-    HirDisplay, Ty,
-    db::HirDatabase,
-};
+use hir::{db::HirDatabase, HirDisplay, Ty};
 use ra_syntax::{
+    ast::{AstNode, LetStmt, NameOwner, PatKind},
     T,
-    ast::{LetStmt, PatKind, NameOwner, AstNode}
 };
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 /// Add explicit type assist.
 pub(crate) fn add_explicit_type(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
@@ -56,7 +53,7 @@ fn is_unknown(ty: &Ty) -> bool {
 mod tests {
     use super::*;
 
-    use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable };
+    use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
 
     #[test]
     fn add_explicit_type_target() {
diff --git a/crates/ra_assists/src/add_impl.rs b/crates/ra_assists/src/add_impl.rs
index fa1c858906..b81922c1d2 100644
--- a/crates/ra_assists/src/add_impl.rs
+++ b/crates/ra_assists/src/add_impl.rs
@@ -1,11 +1,11 @@
-use join_to_string::join;
 use hir::db::HirDatabase;
+use join_to_string::join;
 use ra_syntax::{
     ast::{self, AstNode, NameOwner, TypeParamsOwner},
     TextUnit,
 };
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn add_impl(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let nominal = ctx.node_at_offset::<ast::NominalDef>()?;
diff --git a/crates/ra_assists/src/add_missing_impl_members.rs b/crates/ra_assists/src/add_missing_impl_members.rs
index 0c903a5632..7fc8f63b3e 100644
--- a/crates/ra_assists/src/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/add_missing_impl_members.rs
@@ -1,9 +1,12 @@
-use crate::{Assist, AssistId, AssistCtx, ast_editor::{AstEditor, AstBuilder}};
+use crate::{
+    ast_editor::{AstBuilder, AstEditor},
+    Assist, AssistCtx, AssistId,
+};
 
-use hir::{HasSource, db::HirDatabase};
-use ra_syntax::{SmolStr, TreeArc};
-use ra_syntax::ast::{self, AstNode, ImplItem, ImplItemKind, NameOwner};
+use hir::{db::HirDatabase, HasSource};
 use ra_db::FilePosition;
+use ra_syntax::ast::{self, AstNode, ImplItem, ImplItemKind, NameOwner};
+use ra_syntax::{SmolStr, TreeArc};
 
 #[derive(PartialEq)]
 enum AddMissingImplMembersMode {
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs
index 1d58d9e710..0ba5f3ae67 100644
--- a/crates/ra_assists/src/assist_ctx.rs
+++ b/crates/ra_assists/src/assist_ctx.rs
@@ -1,13 +1,13 @@
 use hir::db::HirDatabase;
-use ra_text_edit::TextEditBuilder;
 use ra_db::FileRange;
+use ra_fmt::{leading_indent, reindent};
 use ra_syntax::{
-    SourceFile, TextRange, AstNode, TextUnit, SyntaxNode, SyntaxElement, SyntaxToken,
-    algo::{find_token_at_offset, find_node_at_offset, find_covering_element, TokenAtOffset},
+    algo::{find_covering_element, find_node_at_offset, find_token_at_offset, TokenAtOffset},
+    AstNode, SourceFile, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextUnit,
 };
-use ra_fmt::{leading_indent, reindent};
+use ra_text_edit::TextEditBuilder;
 
-use crate::{AssistLabel, AssistAction, AssistId};
+use crate::{AssistAction, AssistId, AssistLabel};
 
 #[derive(Clone, Debug)]
 pub(crate) enum Assist {
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs
index 5f8ba3df66..c9a5cf8d94 100644
--- a/crates/ra_assists/src/ast_editor.rs
+++ b/crates/ra_assists/src/ast_editor.rs
@@ -1,10 +1,12 @@
 use std::{iter, ops::RangeInclusive};
 
 use arrayvec::ArrayVec;
-use ra_text_edit::TextEditBuilder;
-use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction, T};
-use ra_fmt::leading_indent;
 use hir::Name;
+use ra_fmt::leading_indent;
+use ra_syntax::{
+    ast, AstNode, Direction, InsertPosition, SourceFile, SyntaxElement, SyntaxKind::*, TreeArc, T,
+};
+use ra_text_edit::TextEditBuilder;
 
 pub struct AstEditor<N: AstNode> {
     original_ast: TreeArc<N>,
@@ -283,7 +285,7 @@ fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> {
 
 mod tokens {
     use once_cell::sync::Lazy;
-    use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*, T};
+    use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T};
 
     static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree);
 
diff --git a/crates/ra_assists/src/auto_import.rs b/crates/ra_assists/src/auto_import.rs
index 9617beb5c5..75ab8fa0f8 100644
--- a/crates/ra_assists/src/auto_import.rs
+++ b/crates/ra_assists/src/auto_import.rs
@@ -1,14 +1,15 @@
+use hir::{self, db::HirDatabase};
 use ra_text_edit::TextEditBuilder;
-use hir::{ self, db::HirDatabase};
 
-use ra_syntax::{
-    T,
-    ast::{ self, NameOwner }, AstNode, SyntaxNode, Direction, TextRange, SmolStr,
-    SyntaxKind::{ PATH, PATH_SEGMENT }
-};
 use crate::{
+    assist_ctx::{Assist, AssistCtx},
     AssistId,
-    assist_ctx::{AssistCtx, Assist},
+};
+use ra_syntax::{
+    ast::{self, NameOwner},
+    AstNode, Direction, SmolStr,
+    SyntaxKind::{PATH, PATH_SEGMENT},
+    SyntaxNode, TextRange, T,
 };
 
 fn collect_path_segments_raw<'a>(
@@ -577,7 +578,7 @@ pub(crate) fn auto_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::helpers::{ check_assist, check_assist_not_applicable };
+    use crate::helpers::{check_assist, check_assist_not_applicable};
 
     #[test]
     fn test_auto_import_add_use_no_anchor() {
diff --git a/crates/ra_assists/src/change_visibility.rs b/crates/ra_assists/src/change_visibility.rs
index 4eb24d27f7..6cabba3e3d 100644
--- a/crates/ra_assists/src/change_visibility.rs
+++ b/crates/ra_assists/src/change_visibility.rs
@@ -1,12 +1,15 @@
 use hir::db::HirDatabase;
 use ra_syntax::{
-    T,
-    AstNode, SyntaxNode, TextUnit,
-    ast::{self, VisibilityOwner, NameOwner},
-    SyntaxKind::{VISIBILITY, FN_DEF, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF, IDENT, WHITESPACE, COMMENT, ATTR},
+    ast::{self, NameOwner, VisibilityOwner},
+    AstNode,
+    SyntaxKind::{
+        ATTR, COMMENT, ENUM_DEF, FN_DEF, IDENT, MODULE, STRUCT_DEF, TRAIT_DEF, VISIBILITY,
+        WHITESPACE,
+    },
+    SyntaxNode, TextUnit, T,
 };
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn change_visibility(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     if let Some(vis) = ctx.node_at_offset::<ast::Visibility>() {
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs
index 71b101b403..d51010b846 100644
--- a/crates/ra_assists/src/fill_match_arms.rs
+++ b/crates/ra_assists/src/fill_match_arms.rs
@@ -1,13 +1,10 @@
-use std::fmt::Write;
 use itertools::Itertools;
+use std::fmt::Write;
 
-use hir::{
-    AdtDef, FieldSource, HasSource,
-    db::HirDatabase,
-};
+use hir::{db::HirDatabase, AdtDef, FieldSource, HasSource};
 use ra_syntax::ast::{self, AstNode};
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 fn is_trivial_arm(arm: &ast::MatchArm) -> bool {
     fn single_pattern(arm: &ast::MatchArm) -> Option<ast::PatKind> {
diff --git a/crates/ra_assists/src/flip_binexpr.rs b/crates/ra_assists/src/flip_binexpr.rs
index 02d27f66d1..5e41f93461 100644
--- a/crates/ra_assists/src/flip_binexpr.rs
+++ b/crates/ra_assists/src/flip_binexpr.rs
@@ -1,7 +1,7 @@
 use hir::db::HirDatabase;
 use ra_syntax::ast::{AstNode, BinExpr, BinOp};
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 /// Flip binary expression assist.
 pub(crate) fn flip_binexpr(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
@@ -68,7 +68,7 @@ impl From<BinOp> for FlipAction {
 mod tests {
     use super::*;
 
-    use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable };
+    use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
 
     #[test]
     fn flip_binexpr_target_is_the_op() {
diff --git a/crates/ra_assists/src/flip_comma.rs b/crates/ra_assists/src/flip_comma.rs
index 7626ffad32..d8dba779f6 100644
--- a/crates/ra_assists/src/flip_comma.rs
+++ b/crates/ra_assists/src/flip_comma.rs
@@ -1,11 +1,7 @@
 use hir::db::HirDatabase;
-use ra_syntax::{
-    T,
-    Direction,
-    algo::non_trivia_sibling,
-};
+use ra_syntax::{algo::non_trivia_sibling, Direction, T};
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn flip_comma(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let comma = ctx.token_at_offset().find(|leaf| leaf.kind() == T![,])?;
diff --git a/crates/ra_assists/src/inline_local_variable.rs b/crates/ra_assists/src/inline_local_variable.rs
index e0479ef130..554de8b467 100644
--- a/crates/ra_assists/src/inline_local_variable.rs
+++ b/crates/ra_assists/src/inline_local_variable.rs
@@ -1,11 +1,11 @@
 use hir::db::HirDatabase;
 use ra_syntax::{
-    ast::{self, AstNode, AstToken, PatKind, ExprKind},
+    ast::{self, AstNode, AstToken, ExprKind, PatKind},
     TextRange,
 };
 
-use crate::{Assist, AssistCtx, AssistId};
 use crate::assist_ctx::AssistBuilder;
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn inline_local_varialbe(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let let_stmt = ctx.node_at_offset::<ast::LetStmt>()?;
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs
index 28467d3413..f7f5ccafa5 100644
--- a/crates/ra_assists/src/introduce_variable.rs
+++ b/crates/ra_assists/src/introduce_variable.rs
@@ -1,12 +1,14 @@
-use test_utils::tested_by;
 use hir::db::HirDatabase;
 use ra_syntax::{
     ast::{self, AstNode},
+    SyntaxKind::{
+        BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, WHITESPACE,
+    },
     SyntaxNode, TextUnit,
-    SyntaxKind::{WHITESPACE, MATCH_ARM, LAMBDA_EXPR, PATH_EXPR, BREAK_EXPR, LOOP_EXPR, RETURN_EXPR, COMMENT},
 };
+use test_utils::tested_by;
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     if ctx.frange.range.is_empty() {
@@ -121,7 +123,9 @@ fn anchor_stmt(expr: &ast::Expr) -> Option<(&SyntaxNode, bool)> {
 mod tests {
     use test_utils::covers;
 
-    use crate::helpers::{check_assist_range_not_applicable, check_assist_range, check_assist_range_target};
+    use crate::helpers::{
+        check_assist_range, check_assist_range_not_applicable, check_assist_range_target,
+    };
 
     use super::*;
 
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs
index 28eb0226b7..0d848629d9 100644
--- a/crates/ra_assists/src/lib.rs
+++ b/crates/ra_assists/src/lib.rs
@@ -11,12 +11,12 @@ pub mod ast_editor;
 
 use itertools::Itertools;
 
-use ra_text_edit::TextEdit;
-use ra_syntax::{TextRange, TextUnit};
-use ra_db::FileRange;
 use hir::db::HirDatabase;
+use ra_db::FileRange;
+use ra_syntax::{TextRange, TextUnit};
+use ra_text_edit::TextEdit;
 
-pub(crate) use crate::assist_ctx::{AssistCtx, Assist};
+pub(crate) use crate::assist_ctx::{Assist, AssistCtx};
 
 /// Unique identifier of the assist, should not be shown to the user
 /// directly.
@@ -127,11 +127,11 @@ fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assis
 #[cfg(test)]
 mod helpers {
     use hir::mock::MockDatabase;
-    use ra_syntax::TextRange;
     use ra_db::FileRange;
-    use test_utils::{extract_offset, extract_range, assert_eq_text, add_cursor};
+    use ra_syntax::TextRange;
+    use test_utils::{add_cursor, assert_eq_text, extract_offset, extract_range};
 
-    use crate::{AssistCtx, Assist};
+    use crate::{Assist, AssistCtx};
 
     pub(crate) fn check_assist(
         assist: fn(AssistCtx<MockDatabase>) -> Option<Assist>,
@@ -289,8 +289,8 @@ mod helpers {
 #[cfg(test)]
 mod tests {
     use hir::mock::MockDatabase;
-    use ra_syntax::TextRange;
     use ra_db::FileRange;
+    use ra_syntax::TextRange;
     use test_utils::{extract_offset, extract_range};
 
     #[test]
diff --git a/crates/ra_assists/src/move_guard.rs b/crates/ra_assists/src/move_guard.rs
index 22ba91fb77..e1ce86a33e 100644
--- a/crates/ra_assists/src/move_guard.rs
+++ b/crates/ra_assists/src/move_guard.rs
@@ -1,12 +1,11 @@
 use hir::db::HirDatabase;
 use ra_syntax::{
-    TextUnit,
-    SyntaxElement,
-    ast::{MatchArm, AstNode, AstToken, IfExpr},
     ast,
+    ast::{AstNode, AstToken, IfExpr, MatchArm},
+    SyntaxElement, TextUnit,
 };
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn move_guard_to_arm_body(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let match_arm = ctx.node_at_offset::<MatchArm>()?;
@@ -84,7 +83,7 @@ pub(crate) fn move_arm_cond_to_match_guard(mut ctx: AssistCtx<impl HirDatabase>)
 mod tests {
     use super::*;
 
-    use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable };
+    use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
 
     #[test]
     fn move_guard_to_arm_body_target() {
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/remove_dbg.rs
index 6e900f8ef0..5680f76ca5 100644
--- a/crates/ra_assists/src/remove_dbg.rs
+++ b/crates/ra_assists/src/remove_dbg.rs
@@ -1,10 +1,9 @@
+use crate::{Assist, AssistCtx, AssistId};
 use hir::db::HirDatabase;
 use ra_syntax::{
     ast::{self, AstNode},
-    TextUnit,
-    T
+    TextUnit, T,
 };
-use crate::{AssistCtx, Assist, AssistId};
 
 pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let macro_call = ctx.node_at_offset::<ast::MacroCall>()?;
diff --git a/crates/ra_assists/src/replace_if_let_with_match.rs b/crates/ra_assists/src/replace_if_let_with_match.rs
index 2b451f08d6..c2c7cf70b8 100644
--- a/crates/ra_assists/src/replace_if_let_with_match.rs
+++ b/crates/ra_assists/src/replace_if_let_with_match.rs
@@ -1,8 +1,8 @@
-use ra_syntax::{AstNode, ast};
-use ra_fmt::extract_trivial_expression;
 use hir::db::HirDatabase;
+use ra_fmt::extract_trivial_expression;
+use ra_syntax::{ast, AstNode};
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn replace_if_let_with_match(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let if_expr: &ast::IfExpr = ctx.node_at_offset()?;
diff --git a/crates/ra_assists/src/split_import.rs b/crates/ra_assists/src/split_import.rs
index 881c5ecdc1..a8feb67c8c 100644
--- a/crates/ra_assists/src/split_import.rs
+++ b/crates/ra_assists/src/split_import.rs
@@ -1,13 +1,9 @@
 use std::iter::successors;
 
 use hir::db::HirDatabase;
-use ra_syntax::{
-    T,
-    TextUnit, AstNode,
-    ast,
-};
+use ra_syntax::{ast, AstNode, TextUnit, T};
 
-use crate::{AssistCtx, Assist, AssistId};
+use crate::{Assist, AssistCtx, AssistId};
 
 pub(crate) fn split_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
     let colon_colon = ctx.token_at_offset().find(|leaf| leaf.kind() == T![::])?;
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index 43d3fb7e3a..c25737aaa8 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -1,14 +1,12 @@
 mod vfs_filter;
 
-use std::{path::Path, collections::HashSet, error::Error};
+use std::{collections::HashSet, error::Error, path::Path};
 
 use rustc_hash::FxHashMap;
 
-use ra_db::{
-    CrateGraph, FileId, SourceRootId,
-};
-use ra_ide_api::{AnalysisHost, AnalysisChange};
-use ra_project_model::{ProjectWorkspace, ProjectRoot};
+use ra_db::{CrateGraph, FileId, SourceRootId};
+use ra_ide_api::{AnalysisChange, AnalysisHost};
+use ra_project_model::{ProjectRoot, ProjectWorkspace};
 use ra_vfs::{Vfs, VfsChange};
 use vfs_filter::IncludeRustFiles;
 
@@ -106,8 +104,8 @@ pub fn load(
 
 #[cfg(test)]
 mod tests {
-    use ra_hir::Crate;
     use super::*;
+    use ra_hir::Crate;
 
     #[test]
     fn test_loading_rust_analyzer() {
diff --git a/crates/ra_batch/src/vfs_filter.rs b/crates/ra_batch/src/vfs_filter.rs
index 8552ac999c..2f0d8cb8b7 100644
--- a/crates/ra_batch/src/vfs_filter.rs
+++ b/crates/ra_batch/src/vfs_filter.rs
@@ -1,6 +1,6 @@
-use std::path::PathBuf;
 use ra_project_model::ProjectRoot;
-use ra_vfs::{RootEntry, Filter, RelativePath};
+use ra_vfs::{Filter, RelativePath, RootEntry};
+use std::path::PathBuf;
 
 /// `IncludeRustFiles` is used to convert
 /// from `ProjectRoot` to `RootEntry` for VFS
diff --git a/crates/ra_cli/src/analysis_bench.rs b/crates/ra_cli/src/analysis_bench.rs
index 33d4728387..639ac763ee 100644
--- a/crates/ra_cli/src/analysis_bench.rs
+++ b/crates/ra_cli/src/analysis_bench.rs
@@ -1,10 +1,10 @@
 use std::{
-    path::{PathBuf, Path},
+    path::{Path, PathBuf},
     time::Instant,
 };
 
-use ra_db::{SourceDatabase, salsa::Database};
-use ra_ide_api::{AnalysisHost, Analysis, LineCol, FilePosition};
+use ra_db::{salsa::Database, SourceDatabase};
+use ra_ide_api::{Analysis, AnalysisHost, FilePosition, LineCol};
 
 use crate::Result;
 
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs
index a01c07c3fc..b8ad6aebcb 100644
--- a/crates/ra_cli/src/analysis_stats.rs
+++ b/crates/ra_cli/src/analysis_stats.rs
@@ -1,7 +1,7 @@
-use std::{collections::HashSet, time::Instant, fmt::Write, path::Path};
+use std::{collections::HashSet, fmt::Write, path::Path, time::Instant};
 
 use ra_db::SourceDatabase;
-use ra_hir::{Crate, ModuleDef, Ty, ImplItem, HasSource};
+use ra_hir::{Crate, HasSource, ImplItem, ModuleDef, Ty};
 use ra_syntax::AstNode;
 
 use crate::Result;
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index d2f6544f8d..25edbd5f73 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -1,13 +1,13 @@
 mod analysis_stats;
 mod analysis_bench;
 
-use std::{io::Read, error::Error};
+use std::{error::Error, io::Read};
 
 use clap::{App, Arg, SubCommand};
-use ra_ide_api::{file_structure, Analysis};
-use ra_syntax::{SourceFile, TreeArc, AstNode};
 use flexi_logger::Logger;
+use ra_ide_api::{file_structure, Analysis};
 use ra_prof::profile;
+use ra_syntax::{AstNode, SourceFile, TreeArc};
 
 type Result<T> = std::result::Result<T, Box<dyn Error + Send + Sync>>;
 
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index c103503bd5..5d3a6b3c98 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -197,7 +197,7 @@ impl CrateGraph {
 
 #[cfg(test)]
 mod tests {
-    use super::{CrateGraph, FileId, SmolStr, Edition::Edition2018};
+    use super::{CrateGraph, Edition::Edition2018, FileId, SmolStr};
 
     #[test]
     fn it_should_panic_because_of_cycle_dependencies() {
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs
index f08616100d..11e18a03d3 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -4,17 +4,15 @@ mod input;
 
 use std::{panic, sync::Arc};
 
-use ra_syntax::{TextUnit, TextRange, SourceFile, Parse};
-use relative_path::RelativePathBuf;
 use ra_prof::profile;
+use ra_syntax::{Parse, SourceFile, TextRange, TextUnit};
+use relative_path::RelativePathBuf;
 
-pub use ::salsa as salsa;
 pub use crate::{
     cancellation::Canceled,
-    input::{
-        FileId, CrateId, SourceRoot, SourceRootId, CrateGraph, Dependency, Edition,
-    },
+    input::{CrateGraph, CrateId, Dependency, Edition, FileId, SourceRoot, SourceRootId},
 };
+pub use ::salsa;
 
 pub trait CheckCanceled {
     /// Aborts current query if there are pending changes.
diff --git a/crates/ra_fmt/src/lib.rs b/crates/ra_fmt/src/lib.rs
index aac5a1d235..1c2c04ad2f 100644
--- a/crates/ra_fmt/src/lib.rs
+++ b/crates/ra_fmt/src/lib.rs
@@ -1,11 +1,13 @@
 //! This crate provides some utilities for indenting rust code.
 //!
-use std::iter::successors;
 use itertools::Itertools;
 use ra_syntax::{
-    SyntaxNode, SyntaxKind::*, SyntaxToken, SyntaxKind, T,
     ast::{self, AstNode, AstToken},
+    SyntaxKind,
+    SyntaxKind::*,
+    SyntaxNode, SyntaxToken, T,
 };
+use std::iter::successors;
 
 pub fn reindent(text: &str, indent: &str) -> String {
     let indent = format!("\n{}", indent);
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs
index b3843b35c2..9c0c8fdd0a 100644
--- a/crates/ra_hir/src/adt.rs
+++ b/crates/ra_hir/src/adt.rs
@@ -3,16 +3,15 @@
 
 use std::sync::Arc;
 
-use ra_arena::{RawId, Arena, impl_arena_id};
+use ra_arena::{impl_arena_id, Arena, RawId};
 use ra_syntax::{
+    ast::{self, NameOwner, StructKind, TypeAscriptionOwner},
     TreeArc,
-    ast::{self, NameOwner, StructKind, TypeAscriptionOwner}
 };
 
 use crate::{
-    Name, AsName, Struct, Union, Enum, EnumVariant, Crate, AstDatabase,
-    HirDatabase, StructField, FieldSource, Source, HasSource,
-    type_ref::TypeRef, DefDatabase,
+    type_ref::TypeRef, AsName, AstDatabase, Crate, DefDatabase, Enum, EnumVariant, FieldSource,
+    HasSource, HirDatabase, Name, Source, Struct, StructField, Union,
 };
 
 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 75914ccb07..ed640d7fce 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -3,24 +3,32 @@ pub(crate) mod docs;
 
 use std::sync::Arc;
 
-use ra_db::{CrateId, SourceRootId, Edition, FileId};
-use ra_syntax::{ast::{self, NameOwner, TypeAscriptionOwner}, TreeArc};
+use ra_db::{CrateId, Edition, FileId, SourceRootId};
+use ra_syntax::{
+    ast::{self, NameOwner, TypeAscriptionOwner},
+    TreeArc,
+};
 
 use crate::{
-    Name, AsName, AstId, Ty, Either, KnownName, HasSource,
-    HirDatabase, DefDatabase, AstDatabase,
-    type_ref::TypeRef,
-    nameres::{ModuleScope, Namespace, ImportId, CrateModuleId},
-    expr::{Body, BodySourceMap, validation::ExprValidator},
-    ty::{TraitRef, InferenceResult, primitive::{IntTy, FloatTy, Signedness, IntBitness, FloatBitness}},
     adt::{EnumVariantId, StructFieldId, VariantDef},
+    diagnostics::DiagnosticSink,
+    expr::{validation::ExprValidator, Body, BodySourceMap},
     generics::HasGenericParams,
-    ids::{FunctionId, StructId, EnumId, AstItemDef, ConstId, StaticId, TraitId, TypeAliasId, MacroDefId},
+    ids::{
+        AstItemDef, ConstId, EnumId, FunctionId, MacroDefId, StaticId, StructId, TraitId,
+        TypeAliasId,
+    },
     impl_block::ImplBlock,
+    nameres::{CrateModuleId, ImportId, ModuleScope, Namespace},
     resolve::Resolver,
-    diagnostics::{DiagnosticSink},
-    traits::{TraitItem, TraitData},
+    traits::{TraitData, TraitItem},
+    ty::{
+        primitive::{FloatBitness, FloatTy, IntBitness, IntTy, Signedness},
+        InferenceResult, TraitRef,
+    },
     type_ref::Mutability,
+    type_ref::TypeRef,
+    AsName, AstDatabase, AstId, DefDatabase, Either, HasSource, HirDatabase, KnownName, Name, Ty,
 };
 
 /// hir::Crate describes a single crate. It's the main interface with which
diff --git a/crates/ra_hir/src/code_model/docs.rs b/crates/ra_hir/src/code_model/docs.rs
index da2b9b8547..f696307a7c 100644
--- a/crates/ra_hir/src/code_model/docs.rs
+++ b/crates/ra_hir/src/code_model/docs.rs
@@ -3,8 +3,8 @@ use std::sync::Arc;
 use ra_syntax::ast;
 
 use crate::{
-    HirDatabase, DefDatabase, AstDatabase, HasSource,
-    Module, StructField, Struct, Enum, EnumVariant, Static, Const, Function, Union, Trait, TypeAlias, FieldSource, MacroDef,
+    AstDatabase, Const, DefDatabase, Enum, EnumVariant, FieldSource, Function, HasSource,
+    HirDatabase, MacroDef, Module, Static, Struct, StructField, Trait, TypeAlias, Union,
 };
 
 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
diff --git a/crates/ra_hir/src/code_model/src.rs b/crates/ra_hir/src/code_model/src.rs
index 5785d3b266..72451e0e70 100644
--- a/crates/ra_hir/src/code_model/src.rs
+++ b/crates/ra_hir/src/code_model/src.rs
@@ -1,9 +1,9 @@
-use ra_syntax::{TreeArc, ast};
+use ra_syntax::{ast, TreeArc};
 
 use crate::{
-    HirFileId, DefDatabase, AstDatabase, Module, ModuleSource,
-    StructField, Struct, Enum, Union, EnumVariant, Function, Static, Trait, Const, TypeAlias,
-    FieldSource, MacroDef, ids::AstItemDef,
+    ids::AstItemDef, AstDatabase, Const, DefDatabase, Enum, EnumVariant, FieldSource, Function,
+    HirFileId, MacroDef, Module, ModuleSource, Static, Struct, StructField, Trait, TypeAlias,
+    Union,
 };
 
 pub struct Source<T> {
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index eda22c0b09..a9c6c52d9d 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -1,23 +1,25 @@
 use std::sync::Arc;
 
 use parking_lot::Mutex;
-use ra_syntax::{SyntaxNode, TreeArc, SmolStr, ast};
-use ra_db::{SourceDatabase, salsa};
+use ra_db::{salsa, SourceDatabase};
+use ra_syntax::{ast, SmolStr, SyntaxNode, TreeArc};
 
 use crate::{
-    HirFileId, MacroDefId, AstIdMap, ErasedFileAstId, Crate, Module, MacroCallLoc,
-    Function, FnData, ExprScopes, TypeAlias,
-    Struct, Enum, StructField,
-    Const, ConstData, Static,
-    DefWithBody, Trait,
+    adt::{EnumData, StructData},
+    generics::{GenericDef, GenericParams},
     ids,
-    nameres::{Namespace, ImportSourceMap, RawItems, CrateDefMap},
-    ty::{InferenceResult, Ty, method_resolution::CrateImplBlocks, TypableDef, CallableDef, FnSig, TypeCtor, GenericPredicate, Substs},
-    adt::{StructData, EnumData},
-    impl_block::{ModuleImplBlocks, ImplSourceMap, ImplBlock},
-    generics::{GenericParams, GenericDef},
+    impl_block::{ImplBlock, ImplSourceMap, ModuleImplBlocks},
+    lang_item::{LangItemTarget, LangItems},
+    nameres::{CrateDefMap, ImportSourceMap, Namespace, RawItems},
     traits::TraitData,
-    lang_item::{LangItems, LangItemTarget}, type_alias::TypeAliasData,
+    ty::{
+        method_resolution::CrateImplBlocks, CallableDef, FnSig, GenericPredicate, InferenceResult,
+        Substs, Ty, TypableDef, TypeCtor,
+    },
+    type_alias::TypeAliasData,
+    AstIdMap, Const, ConstData, Crate, DefWithBody, Enum, ErasedFileAstId, ExprScopes, FnData,
+    Function, HirFileId, MacroCallLoc, MacroDefId, Module, Static, Struct, StructField, Trait,
+    TypeAlias,
 };
 
 /// We store all interned things in the single QueryGroup.
diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs
index 2557ef18e3..f5f2e65f39 100644
--- a/crates/ra_hir/src/diagnostics.rs
+++ b/crates/ra_hir/src/diagnostics.rs
@@ -1,9 +1,9 @@
-use std::{fmt, any::Any};
+use std::{any::Any, fmt};
 
-use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode};
+use ra_syntax::{ast, AstPtr, SyntaxNode, SyntaxNodePtr, TextRange, TreeArc};
 use relative_path::RelativePathBuf;
 
-use crate::{HirFileId, HirDatabase, Name};
+use crate::{HirDatabase, HirFileId, Name};
 
 /// Diagnostic defines hir API for errors and warnings.
 ///
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index b1973d19d4..d5b4ba6b6f 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -3,19 +3,25 @@ use std::sync::Arc;
 
 use rustc_hash::FxHashMap;
 
-use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
+use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
 use ra_syntax::{
-    SyntaxNodePtr, AstPtr, AstNode,
-    ast::{self, TryBlockBodyOwner, LoopBodyOwner, ArgListOwner, NameOwner, LiteralKind,ArrayExprKind, TypeAscriptionOwner},
+    ast::{
+        self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, NameOwner,
+        TryBlockBodyOwner, TypeAscriptionOwner,
+    },
+    AstNode, AstPtr, SyntaxNodePtr,
 };
 
 use crate::{
-    Path, Name, HirDatabase, Resolver,DefWithBody, Either, HirFileId, MacroCallLoc, MacroFileKind,
-    HasSource,
     name::AsName,
     type_ref::{Mutability, TypeRef},
+    DefWithBody, Either, HasSource, HirDatabase, HirFileId, MacroCallLoc, MacroFileKind, Name,
+    Path, Resolver,
+};
+use crate::{
+    path::GenericArgs,
+    ty::primitive::{FloatTy, IntTy, UncertainFloatTy, UncertainIntTy},
 };
-use crate::{path::GenericArgs, ty::primitive::{IntTy, UncertainIntTy, FloatTy, UncertainFloatTy}};
 
 pub use self::scope::ExprScopes;
 
@@ -249,8 +255,8 @@ pub enum Expr {
     Literal(Literal),
 }
 
-pub use ra_syntax::ast::PrefixOp as UnaryOp;
 pub use ra_syntax::ast::BinOp as BinaryOp;
+pub use ra_syntax::ast::PrefixOp as UnaryOp;
 #[derive(Debug, Clone, Eq, PartialEq)]
 pub enum Array {
     ElementList(Vec<ExprId>),
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs
index 83d226fc15..f27cc6e8d2 100644
--- a/crates/ra_hir/src/expr/scope.rs
+++ b/crates/ra_hir/src/expr/scope.rs
@@ -1,12 +1,11 @@
 use std::sync::Arc;
 
+use ra_arena::{impl_arena_id, Arena, RawId};
 use rustc_hash::FxHashMap;
-use ra_arena::{Arena, RawId, impl_arena_id};
 
 use crate::{
-    Name, DefWithBody,
-    expr::{PatId, ExprId, Pat, Expr, Body, Statement},
-    HirDatabase,
+    expr::{Body, Expr, ExprId, Pat, PatId, Statement},
+    DefWithBody, HirDatabase, Name,
 };
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -173,10 +172,10 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
 #[cfg(test)]
 mod tests {
     use ra_db::SourceDatabase;
-    use ra_syntax::{algo::find_node_at_offset, AstNode, SyntaxNodePtr, ast};
-    use test_utils::{extract_offset, assert_eq_text};
+    use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SyntaxNodePtr};
+    use test_utils::{assert_eq_text, extract_offset};
 
-    use crate::{source_binder::SourceAnalyzer, mock::MockDatabase};
+    use crate::{mock::MockDatabase, source_binder::SourceAnalyzer};
 
     fn do_check(code: &str, expected: &[&str]) {
         let (off, code) = extract_offset(code);
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs
index 534fd482b4..8206dae2e1 100644
--- a/crates/ra_hir/src/expr/validation.rs
+++ b/crates/ra_hir/src/expr/validation.rs
@@ -1,17 +1,16 @@
-use std::sync::Arc;
 use rustc_hash::FxHashSet;
+use std::sync::Arc;
 
 use ra_syntax::ast::{AstNode, StructLit};
 
+use super::{Expr, ExprId, StructLitField};
 use crate::{
-    expr::AstPtr,
-    HirDatabase, Function, Name, HasSource,
-    diagnostics::{DiagnosticSink, MissingFields},
     adt::AdtDef,
-    Path,
+    diagnostics::{DiagnosticSink, MissingFields},
+    expr::AstPtr,
     ty::InferenceResult,
+    Function, HasSource, HirDatabase, Name, Path,
 };
-use super::{Expr, StructLitField, ExprId};
 
 pub(crate) struct ExprValidator<'a, 'b: 'a> {
     func: Function,
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs
index 462b136b7f..9929331d33 100644
--- a/crates/ra_hir/src/generics.rs
+++ b/crates/ra_hir/src/generics.rs
@@ -5,13 +5,14 @@
 
 use std::sync::Arc;
 
-use ra_syntax::ast::{self, NameOwner, TypeParamsOwner, TypeBoundsOwner, DefaultTypeParamOwner};
+use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner};
 
 use crate::{
-    HasSource,
-    Name, AsName, Function, Struct, Union, Enum, Trait, TypeAlias, ImplBlock, Container, AdtDef,
-    db::{HirDatabase, DefDatabase, AstDatabase},
-    path::Path, type_ref::TypeRef,
+    db::{AstDatabase, DefDatabase, HirDatabase},
+    path::Path,
+    type_ref::TypeRef,
+    AdtDef, AsName, Container, Enum, Function, HasSource, ImplBlock, Name, Struct, Trait,
+    TypeAlias, Union,
 };
 
 /// Data about a generic parameter (to a function, struct, impl, ...).
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index b7215ac034..bd1e2f2e61 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -3,14 +3,12 @@ use std::{
     sync::Arc,
 };
 
-use ra_db::{FileId, salsa};
-use ra_syntax::{TreeArc, AstNode, ast, SyntaxNode};
-use ra_prof::profile;
 use mbe::MacroRules;
+use ra_db::{salsa, FileId};
+use ra_prof::profile;
+use ra_syntax::{ast, AstNode, SyntaxNode, TreeArc};
 
-use crate::{
-    Module, DefDatabase, AstId, FileAstId, AstDatabase, Source, InternDatabase,
-};
+use crate::{AstDatabase, AstId, DefDatabase, FileAstId, InternDatabase, Module, Source};
 
 /// hir makes heavy use of ids: integer (u32) handlers to various things. You
 /// can think of id as a pointer (but without a lifetime) or a file descriptor
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index fb9daf1bf9..ce134b27a4 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -1,21 +1,21 @@
-use std::sync::Arc;
 use rustc_hash::FxHashMap;
+use std::sync::Arc;
 
-use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap};
+use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
 use ra_syntax::{
+    ast::{self, AstNode},
     AstPtr, SourceFile, TreeArc,
-    ast::{self, AstNode}
 };
 
 use crate::{
-    Const, TypeAlias, Function, HirFileId, AstDatabase, HasSource, Source,
-    HirDatabase, DefDatabase, TraitRef,
-    type_ref::TypeRef,
+    code_model::{Module, ModuleSource},
+    generics::HasGenericParams,
     ids::LocationCtx,
     resolve::Resolver,
     ty::Ty,
-    generics::HasGenericParams,
-    code_model::{Module, ModuleSource}
+    type_ref::TypeRef,
+    AstDatabase, Const, DefDatabase, Function, HasSource, HirDatabase, HirFileId, Source, TraitRef,
+    TypeAlias,
 };
 
 #[derive(Debug, Default, PartialEq, Eq)]
diff --git a/crates/ra_hir/src/lang_item.rs b/crates/ra_hir/src/lang_item.rs
index 48b60f2dde..f9fe47b0f6 100644
--- a/crates/ra_hir/src/lang_item.rs
+++ b/crates/ra_hir/src/lang_item.rs
@@ -1,11 +1,11 @@
-use std::sync::Arc;
 use rustc_hash::FxHashMap;
+use std::sync::Arc;
 
-use ra_syntax::{SmolStr, TreeArc, ast::AttrsOwner};
+use ra_syntax::{ast::AttrsOwner, SmolStr, TreeArc};
 
 use crate::{
-    Crate, DefDatabase, Enum, Function, HirDatabase, ImplBlock, Module,
-    Static, Struct, Trait, ModuleDef, AstDatabase, HasSource
+    AstDatabase, Crate, DefDatabase, Enum, Function, HasSource, HirDatabase, ImplBlock, Module,
+    ModuleDef, Static, Struct, Trait,
 };
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index 5afd846f52..ec0676783f 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -47,39 +47,33 @@ mod code_model;
 mod marks;
 
 use crate::{
-    db::{InternDatabase, AstDatabase, DefDatabase, HirDatabase},
+    db::{AstDatabase, DefDatabase, HirDatabase, InternDatabase},
+    ids::MacroFileKind,
     name::{AsName, KnownName},
-    source_id::{FileAstId, AstId},
     resolve::Resolver,
-    ids::MacroFileKind,
+    source_id::{AstId, FileAstId},
 };
 
 pub use self::{
-    either::Either,
-    path::{Path, PathKind},
-    name::Name,
-    source_id::{AstIdMap, ErasedFileAstId},
-    ids::{HirFileId, MacroDefId, MacroCallId, MacroCallLoc, MacroFile},
-    nameres::{PerNs, Namespace, ImportId},
-    ty::{Ty, ApplicationTy, TypeCtor, TraitRef, Substs, display::HirDisplay, CallableDef},
-    impl_block::{ImplBlock, ImplItem},
     adt::AdtDef,
+    either::Either,
     expr::ExprScopes,
+    generics::{GenericParam, GenericParams, HasGenericParams},
+    ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile},
+    impl_block::{ImplBlock, ImplItem},
+    name::Name,
+    nameres::{ImportId, Namespace, PerNs},
+    path::{Path, PathKind},
     resolve::Resolution,
-    generics::{GenericParams, GenericParam, HasGenericParams},
-    source_binder::{SourceAnalyzer, PathResolution, ScopeEntryWithSyntax},
+    source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer},
+    source_id::{AstIdMap, ErasedFileAstId},
+    ty::{display::HirDisplay, ApplicationTy, CallableDef, Substs, TraitRef, Ty, TypeCtor},
 };
 
 pub use self::code_model::{
-    Crate, CrateDependency,
-    DefWithBody,
-    Module, ModuleDef, ModuleSource,
-    Struct, Union, Enum, EnumVariant,
-    Function, FnData,
-    StructField, FieldSource,
-    Static, Const, ConstData,
-    Trait, TypeAlias, MacroDef, Container,
-    BuiltinType,
-    src::{Source, HasSource},
-    docs::{Docs, Documentation, DocDef},
+    docs::{DocDef, Docs, Documentation},
+    src::{HasSource, Source},
+    BuiltinType, Const, ConstData, Container, Crate, CrateDependency, DefWithBody, Enum,
+    EnumVariant, FieldSource, FnData, Function, MacroDef, Module, ModuleDef, ModuleSource, Static,
+    Struct, StructField, Trait, TypeAlias, Union,
 };
diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs
index c57dfbf019..b26ea58c99 100644
--- a/crates/ra_hir/src/mock.rs
+++ b/crates/ra_hir/src/mock.rs
@@ -1,13 +1,12 @@
-use std::{sync::Arc, panic};
+use std::{panic, sync::Arc};
 
 use parking_lot::Mutex;
 use ra_db::{
-    FilePosition, FileId, CrateGraph, SourceRoot, SourceRootId, SourceDatabase, salsa,
-    Edition,
+    salsa, CrateGraph, Edition, FileId, FilePosition, SourceDatabase, SourceRoot, SourceRootId,
 };
 use relative_path::RelativePathBuf;
-use test_utils::{parse_fixture, CURSOR_MARKER, extract_offset};
 use rustc_hash::FxHashMap;
+use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER};
 
 use crate::{db, diagnostics::DiagnosticSink};
 
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
index 06a2dbc760..ba17958eb9 100644
--- a/crates/ra_hir/src/name.rs
+++ b/crates/ra_hir/src/name.rs
@@ -98,15 +98,13 @@ pub(crate) trait AsName {
 
 impl AsName for ast::NameRef {
     fn as_name(&self) -> Name {
-        let name = resolve_name(self.text());
-        Name::new(name)
+        Name::new(self.text().clone())
     }
 }
 
 impl AsName for ast::Name {
     fn as_name(&self) -> Name {
-        let name = resolve_name(self.text());
-        Name::new(name)
+        Name::new(self.text().clone())
     }
 }
 
@@ -186,12 +184,3 @@ impl AsName for KnownName {
         Name::new(s.into())
     }
 }
-
-fn resolve_name(text: &SmolStr) -> SmolStr {
-    let raw_start = "r#";
-    if text.as_str().starts_with(raw_start) {
-        SmolStr::new(&text[raw_start.len()..])
-    } else {
-        text.clone()
-    }
-}
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index f4ca454e4e..53ef8d58ac 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -55,28 +55,24 @@ mod tests;
 
 use std::sync::Arc;
 
+use once_cell::sync::Lazy;
+use ra_arena::{impl_arena_id, Arena, RawId};
+use ra_db::{Edition, FileId};
+use ra_prof::profile;
+use ra_syntax::ast;
 use rustc_hash::{FxHashMap, FxHashSet};
-use ra_arena::{Arena, RawId, impl_arena_id};
-use ra_db::{FileId, Edition};
 use test_utils::tested_by;
-use ra_syntax::ast;
-use ra_prof::profile;
-use once_cell::sync::Lazy;
 
 use crate::{
-    ModuleDef, Name, Crate, Module, MacroDef, AsName, BuiltinType, AstDatabase,
-    DefDatabase, Path, PathKind, HirFileId, Trait,
-    ids::MacroDefId,
-    diagnostics::DiagnosticSink,
-    nameres::diagnostics::DefDiagnostic,
-    either::Either,
-    AstId,
+    diagnostics::DiagnosticSink, either::Either, ids::MacroDefId,
+    nameres::diagnostics::DefDiagnostic, AsName, AstDatabase, AstId, BuiltinType, Crate,
+    DefDatabase, HirFileId, MacroDef, Module, ModuleDef, Name, Path, PathKind, Trait,
 };
 
-pub(crate) use self::raw::{RawItems, ImportSourceMap};
+pub(crate) use self::raw::{ImportSourceMap, RawItems};
 
 pub use self::{
-    per_ns::{PerNs, Namespace},
+    per_ns::{Namespace, PerNs},
     raw::ImportId,
 };
 
@@ -512,14 +508,14 @@ impl CrateDefMap {
 }
 
 mod diagnostics {
+    use ra_syntax::{ast, AstPtr};
     use relative_path::RelativePathBuf;
-    use ra_syntax::{AstPtr, ast};
 
     use crate::{
-        AstId, DefDatabase, AstDatabase,
+        diagnostics::{DiagnosticSink, UnresolvedModule},
         nameres::CrateModuleId,
-        diagnostics::{DiagnosticSink, UnresolvedModule}
-};
+        AstDatabase, AstId, DefDatabase,
+    };
 
     #[derive(Debug, PartialEq, Eq)]
     pub(super) enum DefDiagnostic {
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index ef4d1ed70f..2b07ebf4a5 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -1,22 +1,19 @@
 use arrayvec::ArrayVec;
-use rustc_hash::FxHashMap;
-use relative_path::RelativePathBuf;
-use test_utils::tested_by;
 use ra_db::FileId;
 use ra_syntax::ast;
+use relative_path::RelativePathBuf;
+use rustc_hash::FxHashMap;
+use test_utils::tested_by;
 
 use crate::{
-    Function, Module, Struct, Union, Enum, Const, Static, Trait, TypeAlias, MacroDef,
-    DefDatabase, HirFileId, Name, Path,
-    KnownName, AstId,
+    either::Either,
+    ids::{AstItemDef, LocationCtx, MacroCallId, MacroCallLoc, MacroDefId, MacroFileKind},
     nameres::{
-        Resolution, PerNs, ModuleDef, ReachedFixedPoint, ResolveMode,
-        CrateDefMap, CrateModuleId, ModuleData, ItemOrMacro,
-        diagnostics::DefDiagnostic,
-        raw,
+        diagnostics::DefDiagnostic, raw, CrateDefMap, CrateModuleId, ItemOrMacro, ModuleData,
+        ModuleDef, PerNs, ReachedFixedPoint, Resolution, ResolveMode,
     },
-    ids::{AstItemDef, LocationCtx, MacroCallLoc, MacroCallId, MacroDefId, MacroFileKind},
-    either::Either,
+    AstId, Const, DefDatabase, Enum, Function, HirFileId, KnownName, MacroDef, Module, Name, Path,
+    Static, Struct, Trait, TypeAlias, Union,
 };
 
 pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap {
@@ -666,9 +663,9 @@ fn resolve_submodule(
 mod tests {
     use ra_db::SourceDatabase;
 
-    use crate::{Crate, mock::MockDatabase, DefDatabase};
-    use ra_arena::{Arena};
     use super::*;
+    use crate::{mock::MockDatabase, Crate, DefDatabase};
+    use ra_arena::Arena;
     use rustc_hash::FxHashSet;
 
     fn do_collect_defs(
diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs
index a0afe282c1..7ea59cb759 100644
--- a/crates/ra_hir/src/nameres/raw.rs
+++ b/crates/ra_hir/src/nameres/raw.rs
@@ -1,13 +1,16 @@
-use std::{sync::Arc, ops::Index};
+use std::{ops::Index, sync::Arc};
 
-use test_utils::tested_by;
-use ra_arena::{Arena, impl_arena_id, RawId, map::ArenaMap};
+use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
 use ra_syntax::{
-    AstNode, SourceFile, AstPtr, TreeArc,
-    ast::{self, NameOwner, AttrsOwner},
+    ast::{self, AttrsOwner, NameOwner},
+    AstNode, AstPtr, SourceFile, TreeArc,
 };
+use test_utils::tested_by;
 
-use crate::{DefDatabase, Name, AsName, Path, HirFileId, ModuleSource, AstIdMap, FileAstId, Either, AstDatabase};
+use crate::{
+    AsName, AstDatabase, AstIdMap, DefDatabase, Either, FileAstId, HirFileId, ModuleSource, Name,
+    Path,
+};
 
 /// `RawItems` is a set of top-level items in a file (except for impls).
 ///
diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs
index 67afd5027a..bce9d2d4bc 100644
--- a/crates/ra_hir/src/path.rs
+++ b/crates/ra_hir/src/path.rs
@@ -1,8 +1,11 @@
 use std::sync::Arc;
 
-use ra_syntax::{ast::{self, NameOwner}, AstNode};
+use ra_syntax::{
+    ast::{self, NameOwner},
+    AstNode,
+};
 
-use crate::{Name, AsName, type_ref::TypeRef};
+use crate::{type_ref::TypeRef, AsName, Name};
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct Path {
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 7f8b3812c3..fc981e9b3d 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -4,16 +4,19 @@ use std::sync::Arc;
 use rustc_hash::{FxHashMap, FxHashSet};
 
 use crate::{
-    ModuleDef, Trait, MacroDef,
     code_model::Crate,
     db::HirDatabase,
-    name::{Name, KnownName},
-    nameres::{PerNs, CrateDefMap, CrateModuleId},
+    either::Either,
+    expr::{
+        scope::{ExprScopes, ScopeId},
+        PatId,
+    },
     generics::GenericParams,
-    expr::{scope::{ExprScopes, ScopeId}, PatId},
     impl_block::ImplBlock,
+    name::{KnownName, Name},
+    nameres::{CrateDefMap, CrateModuleId, PerNs},
     path::Path,
-    either::Either,
+    MacroDef, ModuleDef, Trait,
 };
 
 #[derive(Debug, Clone, Default)]
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 08e86844de..429575feef 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -7,21 +7,25 @@
 /// purely for "IDE needs".
 use std::sync::Arc;
 
-use rustc_hash::{FxHashSet, FxHashMap};
 use ra_db::{FileId, FilePosition};
 use ra_syntax::{
-    SyntaxNode, AstPtr, TextUnit, SyntaxNodePtr, TextRange,
-    ast::{self, AstNode, NameOwner},
     algo::find_node_at_offset,
+    ast::{self, AstNode, NameOwner},
+    AstPtr,
     SyntaxKind::*,
+    SyntaxNode, SyntaxNodePtr, TextRange, TextUnit,
 };
+use rustc_hash::{FxHashMap, FxHashSet};
 
 use crate::{
-    HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name,
-    AsName, Module, HirFileId, Crate, Trait, Resolver, Ty, Path, MacroDef,
-    expr::{BodySourceMap, scope::{ScopeId, ExprScopes}},
+    expr,
+    expr::{
+        scope::{ExprScopes, ScopeId},
+        BodySourceMap,
+    },
     ids::LocationCtx,
-    expr, AstId,
+    AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HirDatabase, HirFileId,
+    MacroDef, Module, Name, Path, PerNs, Resolver, Static, Struct, Trait, Ty,
 };
 
 /// Locates the module by `FileId`. Picks topmost module in the file.
diff --git a/crates/ra_hir/src/source_id.rs b/crates/ra_hir/src/source_id.rs
index 986269e001..324b79824e 100644
--- a/crates/ra_hir/src/source_id.rs
+++ b/crates/ra_hir/src/source_id.rs
@@ -1,9 +1,13 @@
-use std::{marker::PhantomData, sync::Arc, hash::{Hash, Hasher}};
+use std::{
+    hash::{Hash, Hasher},
+    marker::PhantomData,
+    sync::Arc,
+};
 
-use ra_arena::{Arena, RawId, impl_arena_id};
-use ra_syntax::{SyntaxNodePtr, TreeArc, SyntaxNode, AstNode, ast};
+use ra_arena::{impl_arena_id, Arena, RawId};
+use ra_syntax::{ast, AstNode, SyntaxNode, SyntaxNodePtr, TreeArc};
 
-use crate::{HirFileId, AstDatabase};
+use crate::{AstDatabase, HirFileId};
 
 /// `AstId` points to an AST node in any file.
 ///
diff --git a/crates/ra_hir/src/traits.rs b/crates/ra_hir/src/traits.rs
index f2950e1b29..fc03683030 100644
--- a/crates/ra_hir/src/traits.rs
+++ b/crates/ra_hir/src/traits.rs
@@ -1,13 +1,13 @@
 //! HIR for trait definitions.
 
-use std::sync::Arc;
 use rustc_hash::FxHashMap;
+use std::sync::Arc;
 
 use ra_syntax::ast::{self, NameOwner};
 
 use crate::{
-    Function, Const, TypeAlias, Name, DefDatabase, Trait, AstDatabase, Module, HasSource,
-    ids::LocationCtx, name::AsName,
+    ids::LocationCtx, name::AsName, AstDatabase, Const, DefDatabase, Function, HasSource, Module,
+    Name, Trait, TypeAlias,
 };
 
 #[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 842d49e1fd..11afdc0f34 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -12,17 +12,20 @@ mod lower;
 mod infer;
 pub(crate) mod display;
 
-use std::sync::Arc;
 use std::ops::Deref;
+use std::sync::Arc;
 use std::{fmt, mem};
 
-use crate::{Name, AdtDef, type_ref::Mutability, db::HirDatabase, Trait, GenericParams, TypeAlias};
+use crate::{db::HirDatabase, type_ref::Mutability, AdtDef, GenericParams, Name, Trait, TypeAlias};
 use display::{HirDisplay, HirFormatter};
 
-pub(crate) use lower::{TypableDef, type_for_def, type_for_field, callable_item_sig, generic_predicates, generic_defaults};
-pub(crate) use infer::{infer_query, InferenceResult, InferTy};
-pub use lower::CallableDef;
 pub(crate) use autoderef::autoderef;
+pub(crate) use infer::{infer_query, InferTy, InferenceResult};
+pub use lower::CallableDef;
+pub(crate) use lower::{
+    callable_item_sig, generic_defaults, generic_predicates, type_for_def, type_for_field,
+    TypableDef,
+};
 pub(crate) use traits::ProjectionPredicate;
 
 /// A type constructor or type name: this might be something like the primitive
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs
index 1f443d49b6..90c1ae630e 100644
--- a/crates/ra_hir/src/ty/autoderef.rs
+++ b/crates/ra_hir/src/ty/autoderef.rs
@@ -7,8 +7,8 @@ use std::iter::successors;
 
 use log::{info, warn};
 
-use crate::{HirDatabase, Name, Resolver, HasGenericParams};
-use super::{traits::Solution, Ty, Canonical};
+use super::{traits::Solution, Canonical, Ty};
+use crate::{HasGenericParams, HirDatabase, Name, Resolver};
 
 const AUTODEREF_RECURSION_LIMIT: usize = 10;
 
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index 2c05ca734c..a2dc923704 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -15,38 +15,37 @@
 
 use std::borrow::Cow;
 use std::iter::repeat;
+use std::mem;
 use std::ops::Index;
 use std::sync::Arc;
-use std::mem;
 
-use ena::unify::{InPlaceUnificationTable, UnifyKey, UnifyValue, NoError};
+use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue};
 use rustc_hash::FxHashMap;
 
 use ra_arena::map::ArenaMap;
 use ra_prof::profile;
 use test_utils::tested_by;
 
+use super::{
+    autoderef, method_resolution, op, primitive,
+    traits::{Guidance, Obligation, Solution},
+    ApplicationTy, CallableDef, Substs, TraitRef, Ty, TypableDef, TypeCtor,
+};
 use crate::{
-    Function, StructField, Path, Name, FnData, AdtDef, ConstData, HirDatabase,
-    DefWithBody, ImplItem,
-    type_ref::{TypeRef, Mutability},
+    adt::VariantDef,
+    diagnostics::DiagnosticSink,
     expr::{
-        Body, Expr, BindingAnnotation, Literal, ExprId, Pat, PatId, UnaryOp, BinaryOp, Statement,
-        FieldPat, Array, self,
+        self, Array, BinaryOp, BindingAnnotation, Body, Expr, ExprId, FieldPat, Literal, Pat,
+        PatId, Statement, UnaryOp,
     },
     generics::{GenericParams, HasGenericParams},
-    path::{GenericArgs, GenericArg},
-    ModuleDef,
-    adt::VariantDef,
-    resolve::{Resolver, Resolution},
     nameres::Namespace,
+    path::{GenericArg, GenericArgs},
+    resolve::{Resolution, Resolver},
     ty::infer::diagnostics::InferenceDiagnostic,
-    diagnostics::DiagnosticSink,
-};
-use super::{
-    Ty, TypableDef, Substs, primitive, op, ApplicationTy, TypeCtor, CallableDef, TraitRef,
-    traits::{Solution, Obligation, Guidance},
-    method_resolution, autoderef,
+    type_ref::{Mutability, TypeRef},
+    AdtDef, ConstData, DefWithBody, FnData, Function, HirDatabase, ImplItem, ModuleDef, Name, Path,
+    StructField,
 };
 
 mod unify;
@@ -1415,10 +1414,10 @@ impl Expectation {
 
 mod diagnostics {
     use crate::{
-        expr::ExprId,
         diagnostics::{DiagnosticSink, NoSuchField},
-        HirDatabase, Function, HasSource,
-};
+        expr::ExprId,
+        Function, HasSource, HirDatabase,
+    };
 
     #[derive(Debug, PartialEq, Eq, Clone)]
     pub(super) enum InferenceDiagnostic {
diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs
index bc97197258..04633bdb23 100644
--- a/crates/ra_hir/src/ty/infer/unify.rs
+++ b/crates/ra_hir/src/ty/infer/unify.rs
@@ -1,8 +1,8 @@
 //! Unification and canonicalization logic.
 
-use crate::db::HirDatabase;
-use crate::ty::{Ty, Canonical, TraitRef, InferTy};
 use super::InferenceContext;
+use crate::db::HirDatabase;
+use crate::ty::{Canonical, InferTy, TraitRef, Ty};
 
 impl<'a, D: HirDatabase> InferenceContext<'a, D> {
     pub(super) fn canonicalizer<'b>(&'b mut self) -> Canonicalizer<'a, 'b, D>
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index cb494baf48..8b1b2a7f9d 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -5,23 +5,22 @@
 //!  - Building the type for an item: This happens through the `type_for_def` query.
 //!
 //! This usually involves resolving names, collecting generic arguments etc.
-use std::sync::Arc;
 use std::iter;
+use std::sync::Arc;
 
+use super::{FnSig, GenericPredicate, Substs, TraitRef, Ty, TypeCtor};
 use crate::{
-    Function, Struct, Union, StructField, Enum, EnumVariant, Path, ModuleDef, TypeAlias, Const, Static,
-    HirDatabase, BuiltinType,
-    type_ref::TypeRef,
-    nameres::Namespace,
-    resolve::{Resolver, Resolution},
-    path::{PathSegment, GenericArg},
-    generics::{HasGenericParams},
     adt::VariantDef,
-    Trait,
-    generics::{WherePredicate, GenericDef},
+    generics::HasGenericParams,
+    generics::{GenericDef, WherePredicate},
+    nameres::Namespace,
+    path::{GenericArg, PathSegment},
+    resolve::{Resolution, Resolver},
     ty::AdtDef,
+    type_ref::TypeRef,
+    BuiltinType, Const, Enum, EnumVariant, Function, HirDatabase, ModuleDef, Path, Static, Struct,
+    StructField, Trait, TypeAlias, Union,
 };
-use super::{Ty, FnSig, Substs, TypeCtor, TraitRef, GenericPredicate};
 
 impl Ty {
     pub(crate) fn from_hir(db: &impl HirDatabase, resolver: &Resolver, type_ref: &TypeRef) -> Self {
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index e023ff25a2..bc890fe798 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -7,17 +7,17 @@ use std::sync::Arc;
 use arrayvec::ArrayVec;
 use rustc_hash::FxHashMap;
 
+use super::{autoderef, Canonical, TraitRef};
 use crate::{
-    HirDatabase, Module, Crate, Name, Function, Trait,
-    impl_block::{ImplId, ImplBlock, ImplItem},
-    ty::{Ty, TypeCtor},
+    generics::HasGenericParams,
+    impl_block::{ImplBlock, ImplId, ImplItem},
     nameres::CrateModuleId,
     resolve::Resolver,
     traits::TraitItem,
-    generics::HasGenericParams,
-    ty::primitive::{UncertainIntTy, UncertainFloatTy}
+    ty::primitive::{UncertainFloatTy, UncertainIntTy},
+    ty::{Ty, TypeCtor},
+    Crate, Function, HirDatabase, Module, Name, Trait,
 };
-use super::{TraitRef, Canonical, autoderef};
 
 /// This is used as a key for indexing impls.
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
diff --git a/crates/ra_hir/src/ty/op.rs b/crates/ra_hir/src/ty/op.rs
index 235661a5d8..9ba8682980 100644
--- a/crates/ra_hir/src/ty/op.rs
+++ b/crates/ra_hir/src/ty/op.rs
@@ -1,5 +1,5 @@
-use crate::{ ty::ApplicationTy, expr::BinaryOp};
-use super::{Ty, TypeCtor, InferTy};
+use super::{InferTy, Ty, TypeCtor};
+use crate::{expr::BinaryOp, ty::ApplicationTy};
 
 pub(super) fn binary_op_return_ty(op: BinaryOp, rhs_ty: Ty) -> Ty {
     match op {
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index 69c03a36cd..3c902451bf 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -1,16 +1,16 @@
 //! Trait solving using Chalk.
 use std::sync::Arc;
 
-use parking_lot::Mutex;
-use rustc_hash::FxHashSet;
-use log::debug;
 use chalk_ir::cast::Cast;
+use log::debug;
+use parking_lot::Mutex;
 use ra_prof::profile;
+use rustc_hash::FxHashSet;
 
-use crate::{Crate, Trait, db::HirDatabase, ImplBlock};
-use super::{TraitRef, Ty, Canonical, ProjectionTy};
+use super::{Canonical, ProjectionTy, TraitRef, Ty};
+use crate::{db::HirDatabase, Crate, ImplBlock, Trait};
 
-use self::chalk::{ToChalk, from_chalk};
+use self::chalk::{from_chalk, ToChalk};
 
 pub(crate) mod chalk;
 
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index 4ceb8b70bc..2a0537bc33 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -3,20 +3,25 @@ use std::sync::Arc;
 
 use log::debug;
 
-use chalk_ir::{TypeId, ImplId, TypeKindId, Parameter, Identifier, cast::Cast, PlaceholderIndex, UniverseIndex, TypeName};
-use chalk_rust_ir::{AssociatedTyDatum, TraitDatum, StructDatum, ImplDatum};
+use chalk_ir::{
+    cast::Cast, Identifier, ImplId, Parameter, PlaceholderIndex, TypeId, TypeKindId, TypeName,
+    UniverseIndex,
+};
+use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum};
 
-use test_utils::tested_by;
 use ra_db::salsa::{InternId, InternKey};
+use test_utils::tested_by;
 
+use super::ChalkContext;
 use crate::{
-    Trait, HasGenericParams, ImplBlock, Crate,
     db::HirDatabase,
-    ty::{TraitRef, Ty, ApplicationTy, TypeCtor, Substs, GenericPredicate, CallableDef, ProjectionTy},
+    generics::GenericDef,
     ty::display::HirDisplay,
-    generics::GenericDef, TypeAlias, ImplItem,
+    ty::{
+        ApplicationTy, CallableDef, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor,
+    },
+    Crate, HasGenericParams, ImplBlock, ImplItem, Trait, TypeAlias,
 };
-use super::ChalkContext;
 
 /// This represents a trait whose name we could not resolve.
 const UNKNOWN_TRAIT: chalk_ir::TraitId =
diff --git a/crates/ra_hir/src/type_alias.rs b/crates/ra_hir/src/type_alias.rs
index eada372741..3b38c4740a 100644
--- a/crates/ra_hir/src/type_alias.rs
+++ b/crates/ra_hir/src/type_alias.rs
@@ -4,7 +4,12 @@ use std::sync::Arc;
 
 use ra_syntax::ast::NameOwner;
 
-use crate::{TypeAlias, db::{DefDatabase, AstDatabase}, type_ref::TypeRef, name::{Name, AsName}, HasSource};
+use crate::{
+    db::{AstDatabase, DefDatabase},
+    name::{AsName, Name},
+    type_ref::TypeRef,
+    HasSource, TypeAlias,
+};
 
 #[derive(Debug, Clone, PartialEq, Eq)]
 pub struct TypeAliasData {
diff --git a/crates/ra_ide_api/src/assists.rs b/crates/ra_ide_api/src/assists.rs
index 355c0a42aa..e3d1ac5298 100644
--- a/crates/ra_ide_api/src/assists.rs
+++ b/crates/ra_ide_api/src/assists.rs
@@ -1,6 +1,6 @@
-use ra_db::{FileRange, FilePosition};
+use ra_db::{FilePosition, FileRange};
 
-use crate::{SourceFileEdit, SourceChange, db::RootDatabase};
+use crate::{db::RootDatabase, SourceChange, SourceFileEdit};
 
 pub use ra_assists::AssistId;
 
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs
index 2948c646bb..368fdcaa1e 100644
--- a/crates/ra_ide_api/src/call_info.rs
+++ b/crates/ra_ide_api/src/call_info.rs
@@ -1,12 +1,12 @@
-use test_utils::tested_by;
 use ra_db::SourceDatabase;
 use ra_syntax::{
-    AstNode, SyntaxNode, TextUnit,
-    ast::{self, ArgListOwner},
     algo::find_node_at_offset,
+    ast::{self, ArgListOwner},
+    AstNode, SyntaxNode, TextUnit,
 };
+use test_utils::tested_by;
 
-use crate::{FilePosition, CallInfo, FunctionSignature, db::RootDatabase};
+use crate::{db::RootDatabase, CallInfo, FilePosition, FunctionSignature};
 
 /// Computes parameter information for the given call expression.
 pub(crate) fn call_info(db: &RootDatabase, position: FilePosition) -> Option<CallInfo> {
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs
index c0c289335e..2a1af0a0a3 100644
--- a/crates/ra_ide_api/src/change.rs
+++ b/crates/ra_ide_api/src/change.rs
@@ -1,22 +1,19 @@
-use std::{
-    fmt, time,
-    sync::Arc,
-};
+use std::{fmt, sync::Arc, time};
 
-use rustc_hash::FxHashMap;
 use ra_db::{
-    SourceRootId, FileId, CrateGraph, SourceDatabase, SourceRoot,
     salsa::{Database, SweepStrategy},
+    CrateGraph, FileId, SourceDatabase, SourceRoot, SourceRootId,
 };
+use ra_prof::{memory_usage, profile, Bytes};
 use ra_syntax::SourceFile;
-use ra_prof::{profile, Bytes, memory_usage};
-use relative_path::RelativePathBuf;
 use rayon::prelude::*;
+use relative_path::RelativePathBuf;
+use rustc_hash::FxHashMap;
 
 use crate::{
     db::RootDatabase,
-    symbol_index::{SymbolIndex, SymbolsDatabase},
     status::syntax_tree_stats,
+    symbol_index::{SymbolIndex, SymbolsDatabase},
 };
 
 #[derive(Default)]
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index 3a75bbf921..c23b5da59b 100644
--- a/crates/ra_ide_api/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
@@ -14,19 +14,19 @@ mod complete_postfix;
 
 use ra_db::SourceDatabase;
 
+#[cfg(test)]
+use crate::completion::completion_item::{check_completion, do_completion};
 use crate::{
-    db,
-    FilePosition,
     completion::{
-        completion_item::{Completions, CompletionKind},
         completion_context::CompletionContext,
+        completion_item::{CompletionKind, Completions},
     },
-
+    db, FilePosition,
 };
-#[cfg(test)]
-use crate::completion::completion_item::{do_completion, check_completion};
 
-pub use crate::completion::completion_item::{CompletionItem, CompletionItemKind, InsertTextFormat};
+pub use crate::completion::completion_item::{
+    CompletionItem, CompletionItemKind, InsertTextFormat,
+};
 
 /// Main entry point for completion. We run completion as a two-phase process.
 ///
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index a97e876e95..a5f071442b 100644
--- a/crates/ra_ide_api/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
@@ -1,4 +1,4 @@
-use hir::{Ty, AdtDef, TypeCtor};
+use hir::{AdtDef, Ty, TypeCtor};
 
 use crate::completion::{CompletionContext, Completions};
 use rustc_hash::FxHashSet;
@@ -49,7 +49,7 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty
 
 #[cfg(test)]
 mod tests {
-    use crate::completion::{do_completion, CompletionKind, CompletionItem};
+    use crate::completion::{do_completion, CompletionItem, CompletionKind};
     use insta::assert_debug_snapshot_matches;
 
     fn do_ref_completion(code: &str) -> Vec<CompletionItem> {
diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs
index d738ffc136..5a117c4850 100644
--- a/crates/ra_ide_api/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs
@@ -1,11 +1,10 @@
 use ra_syntax::{
     algo::visit::{visitor_ctx, VisitorCtx},
-    ast,
-    AstNode,
+    ast, AstNode,
 };
 use rustc_hash::FxHashMap;
 
-use crate::completion::{CompletionContext, Completions, CompletionKind, CompletionItem};
+use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions};
 
 /// Complete repeated parameters, both name and type. For example, if all
 /// functions in a file have a `spam: &mut Spam` parameter, a completion with
diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs
index cfb9fd6e8c..034ed934df 100644
--- a/crates/ra_ide_api/src/completion/complete_keyword.rs
+++ b/crates/ra_ide_api/src/completion/complete_keyword.rs
@@ -1,11 +1,14 @@
 use ra_syntax::{
     algo::visit::{visitor, Visitor},
-    AstNode,
     ast::{self, LoopBodyOwner},
-    SyntaxKind::*, SyntaxToken,
+    AstNode,
+    SyntaxKind::*,
+    SyntaxToken,
 };
 
-use crate::completion::{CompletionContext, CompletionItem, Completions, CompletionKind, CompletionItemKind};
+use crate::completion::{
+    CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
+};
 
 pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionContext) {
     // complete keyword "crate" in use stmt
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index da8fb9d8e9..29586cd1f1 100644
--- a/crates/ra_ide_api/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
@@ -1,8 +1,8 @@
-use hir::{Resolution, Either};
+use hir::{Either, Resolution};
 use ra_syntax::AstNode;
 use test_utils::tested_by;
 
-use crate::completion::{Completions, CompletionContext};
+use crate::completion::{CompletionContext, Completions};
 
 pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
     let path = match &ctx.path_prefix {
@@ -78,7 +78,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
 mod tests {
     use test_utils::covers;
 
-    use crate::completion::{CompletionKind, do_completion, CompletionItem};
+    use crate::completion::{do_completion, CompletionItem, CompletionKind};
     use insta::assert_debug_snapshot_matches;
 
     fn do_reference_completion(code: &str) -> Vec<CompletionItem> {
diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs
index 6655a05a7c..f12dfcc17f 100644
--- a/crates/ra_ide_api/src/completion/complete_pattern.rs
+++ b/crates/ra_ide_api/src/completion/complete_pattern.rs
@@ -27,8 +27,8 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) {
 
 #[cfg(test)]
 mod tests {
+    use crate::completion::{do_completion, CompletionItem, CompletionKind};
     use insta::assert_debug_snapshot_matches;
-    use crate::completion::{CompletionItem, CompletionKind, do_completion};
 
     fn complete(code: &str) -> Vec<CompletionItem> {
         do_completion(code, CompletionKind::Reference)
diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs
index e20a12e2ac..7042d8bff0 100644
--- a/crates/ra_ide_api/src/completion/complete_postfix.rs
+++ b/crates/ra_ide_api/src/completion/complete_postfix.rs
@@ -1,18 +1,11 @@
 use crate::{
     completion::{
-        completion_item::{
-            Completions,
-            Builder,
-            CompletionKind,
-        },
         completion_context::CompletionContext,
+        completion_item::{Builder, CompletionKind, Completions},
     },
-    CompletionItem
-};
-use ra_syntax::{
-    ast::AstNode,
-    TextRange
+    CompletionItem,
 };
+use ra_syntax::{ast::AstNode, TextRange};
 use ra_text_edit::TextEditBuilder;
 
 fn postfix_snippet(ctx: &CompletionContext, label: &str, detail: &str, snippet: &str) -> Builder {
@@ -58,7 +51,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
 
 #[cfg(test)]
 mod tests {
-    use crate::completion::{CompletionKind, check_completion};
+    use crate::completion::{check_completion, CompletionKind};
 
     fn check_snippet_completion(test_name: &str, code: &str) {
         check_completion(test_name, code, CompletionKind::Postfix);
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index 0f8cfaae80..1ba8712572 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -1,9 +1,9 @@
-use rustc_hash::FxHashMap;
-use ra_text_edit::TextEditBuilder;
-use ra_syntax::{SmolStr, ast, AstNode};
 use ra_assists::auto_import;
+use ra_syntax::{ast, AstNode, SmolStr};
+use ra_text_edit::TextEditBuilder;
+use rustc_hash::FxHashMap;
 
-use crate::completion::{CompletionItem, Completions, CompletionKind, CompletionContext};
+use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions};
 
 pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) {
     if ctx.is_trivial_path {
@@ -121,7 +121,7 @@ impl ImportResolver {
 
 #[cfg(test)]
 mod tests {
-    use crate::completion::{CompletionKind, check_completion};
+    use crate::completion::{check_completion, CompletionKind};
 
     fn check_reference_completion(name: &str, code: &str) {
         check_completion(name, code, CompletionKind::Reference);
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs
index e1df9e6251..d2d364b57b 100644
--- a/crates/ra_ide_api/src/completion/complete_snippet.rs
+++ b/crates/ra_ide_api/src/completion/complete_snippet.rs
@@ -1,4 +1,7 @@
-use crate::completion::{CompletionItem, Completions, CompletionKind, CompletionItemKind, CompletionContext, completion_item::Builder};
+use crate::completion::{
+    completion_item::Builder, CompletionContext, CompletionItem, CompletionItemKind,
+    CompletionKind, Completions,
+};
 
 fn snippet(ctx: &CompletionContext, label: &str, snippet: &str) -> Builder {
     CompletionItem::new(CompletionKind::Snippet, ctx.source_range(), label)
@@ -36,7 +39,7 @@ fn ${1:feature}() {
 
 #[cfg(test)]
 mod tests {
-    use crate::completion::{CompletionKind, check_completion};
+    use crate::completion::{check_completion, CompletionKind};
 
     fn check_snippet_completion(name: &str, code: &str) {
         check_completion(name, code, CompletionKind::Snippet);
diff --git a/crates/ra_ide_api/src/completion/complete_struct_literal.rs b/crates/ra_ide_api/src/completion/complete_struct_literal.rs
index 1eeea58f64..35fb211133 100644
--- a/crates/ra_ide_api/src/completion/complete_struct_literal.rs
+++ b/crates/ra_ide_api/src/completion/complete_struct_literal.rs
@@ -27,8 +27,8 @@ pub(super) fn complete_struct_literal(acc: &mut Completions, ctx: &CompletionCon
 
 #[cfg(test)]
 mod tests {
+    use crate::completion::{do_completion, CompletionItem, CompletionKind};
     use insta::assert_debug_snapshot_matches;
-    use crate::completion::{CompletionItem, CompletionKind, do_completion};
 
     fn complete(code: &str) -> Vec<CompletionItem> {
         do_completion(code, CompletionKind::Reference)
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index bda7d9bb24..55fdba50d6 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -1,11 +1,11 @@
-use ra_text_edit::AtomTextEdit;
+use hir::source_binder;
 use ra_syntax::{
-    AstNode, SyntaxNode, SourceFile, TextUnit, TextRange, SyntaxToken, Parse,
-    ast,
-    algo::{find_token_at_offset, find_covering_element, find_node_at_offset},
+    algo::{find_covering_element, find_node_at_offset, find_token_at_offset},
+    ast, AstNode, Parse, SourceFile,
     SyntaxKind::*,
+    SyntaxNode, SyntaxToken, TextRange, TextUnit,
 };
-use hir::source_binder;
+use ra_text_edit::AtomTextEdit;
 
 use crate::{db, FilePosition};
 
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index 6f2a60640e..f78c4c8772 100644
--- a/crates/ra_ide_api/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
@@ -2,7 +2,7 @@ use std::fmt;
 
 use hir::Documentation;
 use ra_syntax::TextRange;
-use ra_text_edit::{TextEditBuilder, TextEdit};
+use ra_text_edit::{TextEdit, TextEditBuilder};
 
 /// `CompletionItem` describes a single completion variant in the editor pop-up.
 /// It is basically a POD with various properties. To construct a
@@ -285,8 +285,8 @@ impl Into<Vec<CompletionItem>> for Completions {
 
 #[cfg(test)]
 pub(crate) fn do_completion(code: &str, kind: CompletionKind) -> Vec<CompletionItem> {
-    use crate::mock_analysis::{single_file_with_position, analysis_and_position};
     use crate::completion::completions;
+    use crate::mock_analysis::{analysis_and_position, single_file_with_position};
     let (analysis, position) = if code.contains("//-") {
         analysis_and_position(code)
     } else {
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs
index 9739367365..98060947a3 100644
--- a/crates/ra_ide_api/src/completion/presentation.rs
+++ b/crates/ra_ide_api/src/completion/presentation.rs
@@ -1,16 +1,14 @@
 //! This modules takes care of rendering various defenitions as completion items.
+use hir::{Docs, HasSource, HirDisplay, PerNs, Resolution};
 use join_to_string::join;
-use test_utils::tested_by;
-use hir::{Docs, PerNs, Resolution, HirDisplay, HasSource};
 use ra_syntax::ast::NameOwner;
+use test_utils::tested_by;
 
 use crate::completion::{
-    Completions, CompletionKind, CompletionItemKind, CompletionContext, CompletionItem,
+    CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
 };
 
-use crate::display::{
-    function_label, const_label, type_label,
-};
+use crate::display::{const_label, function_label, type_label};
 
 impl Completions {
     pub(crate) fn add_field(
@@ -178,7 +176,7 @@ impl Completions {
 mod tests {
     use test_utils::covers;
 
-    use crate::completion::{CompletionKind, check_completion};
+    use crate::completion::{check_completion, CompletionKind};
 
     fn check_reference_completion(code: &str, expected_completions: &str) {
         check_completion(code, expected_completions, CompletionKind::Reference);
diff --git a/crates/ra_ide_api/src/db.rs b/crates/ra_ide_api/src/db.rs
index 94977764cf..fc5b06ca87 100644
--- a/crates/ra_ide_api/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
@@ -1,14 +1,14 @@
-use std::{
-    sync::Arc,
-    time,
-};
+use std::{sync::Arc, time};
 
 use ra_db::{
-    CheckCanceled, FileId, Canceled, SourceDatabase,
     salsa::{self, Database},
+    Canceled, CheckCanceled, FileId, SourceDatabase,
 };
 
-use crate::{LineIndex, symbol_index::{self, SymbolsDatabase}};
+use crate::{
+    symbol_index::{self, SymbolsDatabase},
+    LineIndex,
+};
 
 #[salsa::database(
     ra_db::SourceDatabaseStorage,
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index 35b3d77df3..9ab455b0e4 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -1,17 +1,20 @@
 use std::cell::RefCell;
 
+use hir::{
+    diagnostics::{Diagnostic as _, DiagnosticSink},
+    source_binder,
+};
 use itertools::Itertools;
-use hir::{source_binder, diagnostics::{Diagnostic as _, DiagnosticSink}};
+use ra_assists::ast_editor::{AstBuilder, AstEditor};
 use ra_db::SourceDatabase;
+use ra_prof::profile;
 use ra_syntax::{
-    T, Location, TextRange, SyntaxNode,
-    ast::{self, AstNode, NamedFieldList, NamedField},
+    ast::{self, AstNode, NamedField, NamedFieldList},
+    Location, SyntaxNode, TextRange, T,
 };
-use ra_assists::ast_editor::{AstEditor, AstBuilder};
 use ra_text_edit::{TextEdit, TextEditBuilder};
-use ra_prof::profile;
 
-use crate::{Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit, db::RootDatabase};
+use crate::{db::RootDatabase, Diagnostic, FileId, FileSystemEdit, SourceChange, SourceFileEdit};
 
 #[derive(Debug, Copy, Clone)]
 pub enum Severity {
@@ -170,9 +173,9 @@ fn check_struct_shorthand_initialization(
 
 #[cfg(test)]
 mod tests {
-    use test_utils::assert_eq_text;
     use insta::assert_debug_snapshot_matches;
     use ra_syntax::SourceFile;
+    use test_utils::assert_eq_text;
 
     use crate::mock_analysis::single_file;
 
diff --git a/crates/ra_ide_api/src/display.rs b/crates/ra_ide_api/src/display.rs
index 8825188382..cc59e99d88 100644
--- a/crates/ra_ide_api/src/display.rs
+++ b/crates/ra_ide_api/src/display.rs
@@ -6,14 +6,17 @@ mod navigation_target;
 mod structure;
 mod short_label;
 
-use ra_syntax::{ast::{self, AstNode, TypeParamsOwner}, SyntaxKind::{ATTR, COMMENT}};
+use ra_syntax::{
+    ast::{self, AstNode, TypeParamsOwner},
+    SyntaxKind::{ATTR, COMMENT},
+};
 
-pub use navigation_target::NavigationTarget;
-pub use structure::{StructureNode, file_structure};
 pub use function_signature::FunctionSignature;
+pub use navigation_target::NavigationTarget;
+pub use structure::{file_structure, StructureNode};
 
+pub(crate) use navigation_target::{description_from_symbol, docs_from_symbol};
 pub(crate) use short_label::ShortLabel;
-pub(crate) use navigation_target::{docs_from_symbol, description_from_symbol};
 
 pub(crate) fn function_label(node: &ast::FnDef) -> String {
     FunctionSignature::from(node).to_string()
diff --git a/crates/ra_ide_api/src/display/function_signature.rs b/crates/ra_ide_api/src/display/function_signature.rs
index b0b0c71227..e7ad5a0d19 100644
--- a/crates/ra_ide_api/src/display/function_signature.rs
+++ b/crates/ra_ide_api/src/display/function_signature.rs
@@ -1,11 +1,14 @@
 use std::fmt::{self, Display};
 
+use hir::{Docs, Documentation, HasSource};
 use join_to_string::join;
 use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
 use std::convert::From;
-use hir::{Docs, Documentation, HasSource};
 
-use crate::{db, display::{where_predicates, generic_parameters}};
+use crate::{
+    db,
+    display::{generic_parameters, where_predicates},
+};
 
 /// Contains information about a function signature
 #[derive(Debug)]
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs
index 823cdaaf3c..1edb64e3de 100644
--- a/crates/ra_ide_api/src/display/navigation_target.rs
+++ b/crates/ra_ide_api/src/display/navigation_target.rs
@@ -1,14 +1,15 @@
+use hir::{FieldSource, HasSource, ImplItem, ModuleSource};
 use ra_db::{FileId, SourceDatabase};
 use ra_syntax::{
-    SyntaxNode, AstNode, SmolStr, TextRange, AstPtr, TreeArc,
-    SyntaxKind::{self, NAME},
-    ast::{self, DocCommentsOwner},
     algo::visit::{visitor, Visitor},
+    ast::{self, DocCommentsOwner},
+    AstNode, AstPtr, SmolStr,
+    SyntaxKind::{self, NAME},
+    SyntaxNode, TextRange, TreeArc,
 };
-use hir::{ModuleSource, FieldSource, ImplItem, HasSource};
 
-use crate::{FileSymbol, db::RootDatabase};
 use super::short_label::ShortLabel;
+use crate::{db::RootDatabase, FileSymbol};
 
 /// `NavigationTarget` represents and element in the editor's UI which you can
 /// click on to navigate to a particular piece of code.
diff --git a/crates/ra_ide_api/src/display/short_label.rs b/crates/ra_ide_api/src/display/short_label.rs
index dc8245c341..f926f631fc 100644
--- a/crates/ra_ide_api/src/display/short_label.rs
+++ b/crates/ra_ide_api/src/display/short_label.rs
@@ -1,6 +1,4 @@
-use ra_syntax::{
-    ast::{self, NameOwner, VisibilityOwner, TypeAscriptionOwner, AstNode},
-};
+use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner};
 
 pub(crate) trait ShortLabel {
     fn short_label(&self) -> Option<String>;
diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs
index e5057e833f..e5b257b9bd 100644
--- a/crates/ra_ide_api/src/display/structure.rs
+++ b/crates/ra_ide_api/src/display/structure.rs
@@ -2,7 +2,7 @@ use crate::TextRange;
 
 use ra_syntax::{
     algo::visit::{visitor, Visitor},
-    ast::{self, AttrsOwner, NameOwner, TypeParamsOwner, TypeAscriptionOwner},
+    ast::{self, AttrsOwner, NameOwner, TypeAscriptionOwner, TypeParamsOwner},
     AstNode, SourceFile, SyntaxKind, SyntaxNode, WalkEvent,
 };
 
diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs
index a713b762cf..655852514a 100644
--- a/crates/ra_ide_api/src/extend_selection.rs
+++ b/crates/ra_ide_api/src/extend_selection.rs
@@ -1,13 +1,13 @@
 use ra_db::SourceDatabase;
 use ra_syntax::{
-    Direction, SyntaxNode, TextRange, TextUnit, SyntaxElement,
     algo::{find_covering_element, find_token_at_offset, TokenAtOffset},
-    SyntaxKind::*, SyntaxToken,
     ast::{self, AstNode, AstToken},
-    T
+    Direction, SyntaxElement,
+    SyntaxKind::*,
+    SyntaxNode, SyntaxToken, TextRange, TextUnit, T,
 };
 
-use crate::{FileRange, db::RootDatabase};
+use crate::{db::RootDatabase, FileRange};
 
 // FIXME: restore macro support
 pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange {
@@ -205,7 +205,7 @@ fn adj_comments(comment: ast::Comment, dir: Direction) -> ast::Comment {
 
 #[cfg(test)]
 mod tests {
-    use ra_syntax::{SourceFile, AstNode};
+    use ra_syntax::{AstNode, SourceFile};
     use test_utils::extract_offset;
 
     use super::*;
diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs
index 4400ff2323..a1e6f94e08 100644
--- a/crates/ra_ide_api/src/folding_ranges.rs
+++ b/crates/ra_ide_api/src/folding_ranges.rs
@@ -1,9 +1,10 @@
 use rustc_hash::FxHashSet;
 
 use ra_syntax::{
-    SourceFile, SyntaxNode, TextRange, Direction, SyntaxElement,
-    SyntaxKind::{self, *},
     ast::{self, AstNode, AstToken, VisibilityOwner},
+    Direction, SourceFile, SyntaxElement,
+    SyntaxKind::{self, *},
+    SyntaxNode, TextRange,
 };
 
 #[derive(Debug, PartialEq, Eq)]
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 63ba6cf9d3..08feed7dc9 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -1,19 +1,18 @@
 use ra_db::{FileId, SourceDatabase};
 use ra_syntax::{
-    AstNode, ast::{self, DocCommentsOwner},
     algo::{
         find_node_at_offset,
         visit::{visitor, Visitor},
     },
-    SyntaxNode,
+    ast::{self, DocCommentsOwner},
+    AstNode, SyntaxNode,
 };
 
 use crate::{
-    FilePosition, NavigationTarget,
     db::RootDatabase,
-    RangeInfo,
-    name_ref_kind::{NameRefKind::*, classify_name_ref},
     display::ShortLabel,
+    name_ref_kind::{classify_name_ref, NameRefKind::*},
+    FilePosition, NavigationTarget, RangeInfo,
 };
 
 pub(crate) fn goto_definition(
diff --git a/crates/ra_ide_api/src/goto_type_definition.rs b/crates/ra_ide_api/src/goto_type_definition.rs
index 6f5164e0ba..d2d5eae9a1 100644
--- a/crates/ra_ide_api/src/goto_type_definition.rs
+++ b/crates/ra_ide_api/src/goto_type_definition.rs
@@ -1,10 +1,7 @@
 use ra_db::SourceDatabase;
-use ra_syntax::{
-    AstNode, ast,
-    algo::find_token_at_offset
-};
+use ra_syntax::{algo::find_token_at_offset, ast, AstNode};
 
-use crate::{FilePosition, NavigationTarget, db::RootDatabase, RangeInfo};
+use crate::{db::RootDatabase, FilePosition, NavigationTarget, RangeInfo};
 
 pub(crate) fn goto_type_definition(
     db: &RootDatabase,
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index df877c324c..1edeb75793 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -1,16 +1,22 @@
+use hir::{HasSource, HirDisplay};
 use ra_db::SourceDatabase;
 use ra_syntax::{
-    AstNode, TreeArc,
+    algo::{
+        ancestors_at_offset, find_covering_element, find_node_at_offset,
+        visit::{visitor, Visitor},
+    },
     ast::{self, DocCommentsOwner},
-    algo::{find_covering_element, find_node_at_offset, ancestors_at_offset, visit::{visitor, Visitor}},
+    AstNode, TreeArc,
 };
-use hir::{HirDisplay, HasSource};
 
 use crate::{
     db::RootDatabase,
-    RangeInfo, FilePosition, FileRange,
-    display::{rust_code_markup, rust_code_markup_with_doc, ShortLabel, docs_from_symbol, description_from_symbol},
-    name_ref_kind::{NameRefKind::*, classify_name_ref},
+    display::{
+        description_from_symbol, docs_from_symbol, rust_code_markup, rust_code_markup_with_doc,
+        ShortLabel,
+    },
+    name_ref_kind::{classify_name_ref, NameRefKind::*},
+    FilePosition, FileRange, RangeInfo,
 };
 
 /// Contains the results when hovering over an item
@@ -256,8 +262,10 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Option<String> {
 
 #[cfg(test)]
 mod tests {
+    use crate::mock_analysis::{
+        analysis_and_position, single_file_with_position, single_file_with_range,
+    };
     use ra_syntax::TextRange;
-    use crate::mock_analysis::{single_file_with_position, single_file_with_range, analysis_and_position};
 
     fn trim_markup(s: &str) -> &str {
         s.trim_start_matches("```rust\n").trim_end_matches("\n```")
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs
index b80238d9e0..f8a62bd710 100644
--- a/crates/ra_ide_api/src/impls.rs
+++ b/crates/ra_ide_api/src/impls.rs
@@ -1,11 +1,8 @@
-use ra_db::SourceDatabase;
-use ra_syntax::{
-    AstNode, ast,
-    algo::find_node_at_offset,
-};
 use hir::{db::HirDatabase, source_binder};
+use ra_db::SourceDatabase;
+use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
 
-use crate::{FilePosition, NavigationTarget, db::RootDatabase, RangeInfo};
+use crate::{db::RootDatabase, FilePosition, NavigationTarget, RangeInfo};
 
 pub(crate) fn goto_implementation(
     db: &RootDatabase,
diff --git a/crates/ra_ide_api/src/join_lines.rs b/crates/ra_ide_api/src/join_lines.rs
index 3978e96358..8ab485adbe 100644
--- a/crates/ra_ide_api/src/join_lines.rs
+++ b/crates/ra_ide_api/src/join_lines.rs
@@ -1,14 +1,11 @@
 use itertools::Itertools;
+use ra_fmt::{compute_ws, extract_trivial_expression};
 use ra_syntax::{
-    T,
-    SourceFile, TextRange, TextUnit, SyntaxNode, SyntaxElement, SyntaxToken,
-    SyntaxKind::{self, WHITESPACE},
     algo::{find_covering_element, non_trivia_sibling},
     ast::{self, AstNode, AstToken},
-    Direction,
-};
-use ra_fmt::{
-    compute_ws, extract_trivial_expression
+    Direction, SourceFile, SyntaxElement,
+    SyntaxKind::{self, WHITESPACE},
+    SyntaxNode, SyntaxToken, TextRange, TextUnit, T,
 };
 use ra_text_edit::{TextEdit, TextEditBuilder};
 
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 817e65df0f..95de9bcb84 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -46,33 +46,35 @@ mod test_utils;
 
 use std::sync::Arc;
 
-use ra_syntax::{SourceFile, TreeArc, TextRange, TextUnit};
-use ra_text_edit::TextEdit;
 use ra_db::{
-    SourceDatabase, CheckCanceled,
     salsa::{self, ParallelDatabase},
+    CheckCanceled, SourceDatabase,
 };
+use ra_syntax::{SourceFile, TextRange, TextUnit, TreeArc};
+use ra_text_edit::TextEdit;
 use relative_path::RelativePathBuf;
 
-use crate::{symbol_index::FileSymbol, db::LineIndexDatabase};
+use crate::{db::LineIndexDatabase, symbol_index::FileSymbol};
 
 pub use crate::{
+    assists::{Assist, AssistId},
     change::{AnalysisChange, LibraryData},
     completion::{CompletionItem, CompletionItemKind, InsertTextFormat},
-    runnables::{Runnable, RunnableKind},
-    references::ReferenceSearchResult,
-    assists::{Assist, AssistId},
-    hover::{HoverResult},
-    line_index::{LineIndex, LineCol},
-    line_index_utils::translate_offset_with_edit,
+    diagnostics::Severity,
+    display::{file_structure, FunctionSignature, NavigationTarget, StructureNode},
     folding_ranges::{Fold, FoldKind},
+    hover::HoverResult,
+    line_index::{LineCol, LineIndex},
+    line_index_utils::translate_offset_with_edit,
+    references::ReferenceSearchResult,
+    runnables::{Runnable, RunnableKind},
     syntax_highlighting::HighlightedRange,
-    diagnostics::Severity,
-    display::{FunctionSignature, NavigationTarget, StructureNode, file_structure},
 };
 
-pub use ra_db::{Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId, Edition};
 pub use hir::Documentation;
+pub use ra_db::{
+    Canceled, CrateGraph, CrateId, Edition, FileId, FilePosition, FileRange, SourceRootId,
+};
 
 pub type Cancelable<T> = Result<T, Canceled>;
 
diff --git a/crates/ra_ide_api/src/line_index.rs b/crates/ra_ide_api/src/line_index.rs
index a53cf9ee00..71de8a928e 100644
--- a/crates/ra_ide_api/src/line_index.rs
+++ b/crates/ra_ide_api/src/line_index.rs
@@ -145,7 +145,7 @@ pub fn to_line_col(text: &str, offset: TextUnit) -> LineCol {
 mod test_line_index {
     use super::*;
     use proptest::{prelude::*, proptest};
-    use ra_text_edit::test_utils::{arb_text, arb_offset};
+    use ra_text_edit::test_utils::{arb_offset, arb_text};
 
     #[test]
     fn test_line_index() {
diff --git a/crates/ra_ide_api/src/line_index_utils.rs b/crates/ra_ide_api/src/line_index_utils.rs
index a03467011d..f9073dca2c 100644
--- a/crates/ra_ide_api/src/line_index_utils.rs
+++ b/crates/ra_ide_api/src/line_index_utils.rs
@@ -1,6 +1,6 @@
+use crate::{line_index::Utf16Char, LineCol, LineIndex};
+use ra_syntax::{TextRange, TextUnit};
 use ra_text_edit::{AtomTextEdit, TextEdit};
-use ra_syntax::{TextUnit, TextRange};
-use crate::{LineIndex, LineCol, line_index::Utf16Char};
 
 #[derive(Debug, Clone)]
 enum Step {
@@ -292,8 +292,8 @@ pub fn translate_offset_with_edit(
 #[cfg(test)]
 mod test {
     use super::*;
-    use proptest::{prelude::*, proptest};
     use crate::line_index;
+    use proptest::{prelude::*, proptest};
     use ra_text_edit::test_utils::{arb_offset, arb_text_with_edit};
     use ra_text_edit::TextEdit;
 
diff --git a/crates/ra_ide_api/src/matching_brace.rs b/crates/ra_ide_api/src/matching_brace.rs
index 7f3e65b460..438b078964 100644
--- a/crates/ra_ide_api/src/matching_brace.rs
+++ b/crates/ra_ide_api/src/matching_brace.rs
@@ -1,10 +1,4 @@
-use ra_syntax::{
-    SourceFile, TextUnit,
-    algo::find_token_at_offset,
-    SyntaxKind::{self},
-    ast::AstNode,
-    T
-};
+use ra_syntax::{algo::find_token_at_offset, ast::AstNode, SourceFile, SyntaxKind, TextUnit, T};
 
 pub fn matching_brace(file: &SourceFile, offset: TextUnit) -> Option<TextUnit> {
     const BRACES: &[SyntaxKind] =
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs
index cb12dd0b12..4dbbd489ae 100644
--- a/crates/ra_ide_api/src/mock_analysis.rs
+++ b/crates/ra_ide_api/src/mock_analysis.rs
@@ -3,7 +3,10 @@ use std::sync::Arc;
 use relative_path::RelativePathBuf;
 use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER};
 
-use crate::{Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, FilePosition, FileRange, SourceRootId, Edition::Edition2018};
+use crate::{
+    Analysis, AnalysisChange, AnalysisHost, CrateGraph, Edition::Edition2018, FileId, FilePosition,
+    FileRange, SourceRootId,
+};
 
 /// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis
 /// from a set of in-memory files.
diff --git a/crates/ra_ide_api/src/name_ref_kind.rs b/crates/ra_ide_api/src/name_ref_kind.rs
index 000036db42..67381c9c8d 100644
--- a/crates/ra_ide_api/src/name_ref_kind.rs
+++ b/crates/ra_ide_api/src/name_ref_kind.rs
@@ -1,5 +1,5 @@
-use ra_syntax::{AstNode, AstPtr, ast};
 use hir::Either;
+use ra_syntax::{ast, AstNode, AstPtr};
 use test_utils::tested_by;
 
 use crate::db::RootDatabase;
diff --git a/crates/ra_ide_api/src/parent_module.rs b/crates/ra_ide_api/src/parent_module.rs
index 27788c9846..7d5f9ea2c2 100644
--- a/crates/ra_ide_api/src/parent_module.rs
+++ b/crates/ra_ide_api/src/parent_module.rs
@@ -1,6 +1,6 @@
-use ra_db::{FilePosition, FileId, CrateId};
+use ra_db::{CrateId, FileId, FilePosition};
 
-use crate::{NavigationTarget, db::RootDatabase};
+use crate::{db::RootDatabase, NavigationTarget};
 
 /// This returns `Vec` because a module may be included from several places. We
 /// don't handle this case yet though, so the Vec has length at most one.
@@ -29,10 +29,10 @@ pub(crate) fn crate_for(db: &RootDatabase, file_id: FileId) -> Vec<CrateId> {
 #[cfg(test)]
 mod tests {
     use crate::{
-        AnalysisChange, CrateGraph,
         mock_analysis::{analysis_and_position, MockAnalysis},
+        AnalysisChange, CrateGraph,
         Edition::Edition2018,
-};
+    };
 
     #[test]
     fn test_resolve_parent_module() {
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index 12cdc6a6d1..766c0ad743 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -1,22 +1,11 @@
+use hir::{source_binder, Either, ModuleSource};
+use ra_db::SourceDatabase;
+use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode};
 use relative_path::{RelativePath, RelativePathBuf};
-use hir::{ModuleSource, source_binder, Either};
-use ra_db::{SourceDatabase};
-use ra_syntax::{
-    AstNode, SyntaxNode, SourceFile,
-    ast,
-    algo::find_node_at_offset,
-};
 
 use crate::{
-    db::RootDatabase,
-    FilePosition,
-    FileRange,
-    FileId,
-    NavigationTarget,
-    FileSystemEdit,
-    SourceChange,
-    SourceFileEdit,
-    TextRange,
+    db::RootDatabase, FileId, FilePosition, FileRange, FileSystemEdit, NavigationTarget,
+    SourceChange, SourceFileEdit, TextRange,
 };
 
 #[derive(Debug, Clone)]
@@ -210,13 +199,12 @@ fn rename_reference(
 
 #[cfg(test)]
 mod tests {
+    use crate::{
+        mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId,
+        ReferenceSearchResult,
+    };
     use insta::assert_debug_snapshot_matches;
     use test_utils::assert_eq_text;
-    use crate::{
-        mock_analysis::single_file_with_position,
-        mock_analysis::analysis_and_position,
-        FileId, ReferenceSearchResult
-};
 
     #[test]
     fn test_find_all_refs_for_local() {
diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs
index afe629d501..2d2d0b40ef 100644
--- a/crates/ra_ide_api/src/runnables.rs
+++ b/crates/ra_ide_api/src/runnables.rs
@@ -1,9 +1,9 @@
 use itertools::Itertools;
+use ra_db::SourceDatabase;
 use ra_syntax::{
-    TextRange, SyntaxNode,
-    ast::{self, AstNode, NameOwner, ModuleItemOwner, AttrsOwner},
+    ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner},
+    SyntaxNode, TextRange,
 };
-use ra_db::SourceDatabase;
 
 use crate::{db::RootDatabase, FileId};
 
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs
index ce25f4a875..1bcba0b8bd 100644
--- a/crates/ra_ide_api/src/status.rs
+++ b/crates/ra_ide_api/src/status.rs
@@ -1,20 +1,20 @@
-use std::{
-    fmt,
-    iter::FromIterator,
-    sync::Arc,
-};
+use std::{fmt, iter::FromIterator, sync::Arc};
 
-use ra_syntax::{TreeArc, SyntaxNode, Parse, AstNode};
+use hir::MacroFile;
 use ra_db::{
+    salsa::{
+        debug::{DebugQueryTable, TableEntry},
+        Database,
+    },
     FileTextQuery, SourceRootId,
-    salsa::{Database, debug::{DebugQueryTable, TableEntry}},
 };
-use ra_prof::{Bytes, memory_usage};
-use hir::MacroFile;
+use ra_prof::{memory_usage, Bytes};
+use ra_syntax::{AstNode, Parse, SyntaxNode, TreeArc};
 
 use crate::{
-    FileId, db::RootDatabase,
-    symbol_index::{SymbolIndex, LibrarySymbolsQuery},
+    db::RootDatabase,
+    symbol_index::{LibrarySymbolsQuery, SymbolIndex},
+    FileId,
 };
 
 pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats {
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index a6cd7bf610..2ca0a25d44 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -20,31 +20,27 @@
 //! file in the current workspace, and run a query against the union of all
 //! those FSTs.
 use std::{
+    fmt,
     hash::{Hash, Hasher},
-    sync::Arc,
     mem,
-    fmt,
+    sync::Arc,
 };
 
 use fst::{self, Streamer};
-use ra_syntax::{
-    SyntaxNode, SyntaxNodePtr, SourceFile, SmolStr, TreeArc, AstNode,
-    algo::{visit::{visitor, Visitor}},
-    SyntaxKind::{self, *},
-    ast::{self, NameOwner},
-    WalkEvent,
-    TextRange,
-};
 use ra_db::{
-    SourceRootId, SourceDatabase,
     salsa::{self, ParallelDatabase},
+    SourceDatabase, SourceRootId,
+};
+use ra_syntax::{
+    algo::visit::{visitor, Visitor},
+    ast::{self, NameOwner},
+    AstNode, SmolStr, SourceFile,
+    SyntaxKind::{self, *},
+    SyntaxNode, SyntaxNodePtr, TextRange, TreeArc, WalkEvent,
 };
 use rayon::prelude::*;
 
-use crate::{
-    FileId, Query,
-    db::RootDatabase,
-};
+use crate::{db::RootDatabase, FileId, Query};
 
 #[salsa::query_group(SymbolsDatabaseStorage)]
 pub(crate) trait SymbolsDatabase: hir::db::HirDatabase {
@@ -305,15 +301,11 @@ fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> {
 
 #[cfg(test)]
 mod tests {
+    use crate::{display::NavigationTarget, mock_analysis::single_file, Query};
     use ra_syntax::{
         SmolStr,
-        SyntaxKind::{FN_DEF, STRUCT_DEF}
-};
-    use crate::{
-        display::NavigationTarget,
-        mock_analysis::single_file,
-        Query,
-};
+        SyntaxKind::{FN_DEF, STRUCT_DEF},
+    };
 
     #[test]
     fn test_world_symbols_with_no_container() {
diff --git a/crates/ra_ide_api/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index 3a04a51cd8..7c4285b025 100644
--- a/crates/ra_ide_api/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/src/syntax_highlighting.rs
@@ -1,12 +1,12 @@
-use rustc_hash::{FxHashSet, FxHashMap};
+use rustc_hash::{FxHashMap, FxHashSet};
 
-use ra_syntax::{
-    ast, AstNode, TextRange, Direction, SmolStr, SyntaxKind, SyntaxKind::*, SyntaxElement, T,
-};
 use ra_db::SourceDatabase;
 use ra_prof::profile;
+use ra_syntax::{
+    ast, AstNode, Direction, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, TextRange, T,
+};
 
-use crate::{FileId, db::RootDatabase};
+use crate::{db::RootDatabase, FileId};
 
 #[derive(Debug)]
 pub struct HighlightedRange {
@@ -64,7 +64,7 @@ pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Vec<HighlightedRa
                 if let Some(name_ref) = node.as_node().and_then(ast::NameRef::cast) {
                     // FIXME: revisit this after #1340
                     use crate::name_ref_kind::{classify_name_ref, NameRefKind::*};
-                    use hir::{ModuleDef, ImplItem};
+                    use hir::{ImplItem, ModuleDef};
 
                     // FIXME: try to reuse the SourceAnalyzers
                     let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None);
@@ -264,8 +264,8 @@ pre        { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4e
 
 #[cfg(test)]
 mod tests {
-    use test_utils::{project_dir, read_text, assert_eq_text};
     use crate::mock_analysis::single_file;
+    use test_utils::{assert_eq_text, project_dir, read_text};
 
     #[test]
     fn test_highlighting() {
diff --git a/crates/ra_ide_api/src/syntax_tree.rs b/crates/ra_ide_api/src/syntax_tree.rs
index 7165fa97a1..8bdd08d581 100644
--- a/crates/ra_ide_api/src/syntax_tree.rs
+++ b/crates/ra_ide_api/src/syntax_tree.rs
@@ -1,9 +1,9 @@
-use ra_db::SourceDatabase;
 use crate::db::RootDatabase;
+use ra_db::SourceDatabase;
 use ra_syntax::{
-    SourceFile, TextRange, AstNode, SyntaxToken, SyntaxElement,
-    algo,
-    SyntaxKind::{STRING, RAW_STRING},
+    algo, AstNode, SourceFile, SyntaxElement,
+    SyntaxKind::{RAW_STRING, STRING},
+    SyntaxToken, TextRange,
 };
 
 pub use ra_db::FileId;
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs
index 3e35d83523..d3cb71ddba 100644
--- a/crates/ra_ide_api/src/typing.rs
+++ b/crates/ra_ide_api/src/typing.rs
@@ -1,13 +1,14 @@
+use crate::{db::RootDatabase, SourceChange, SourceFileEdit};
+use ra_db::{FilePosition, SourceDatabase};
+use ra_fmt::leading_indent;
 use ra_syntax::{
-    AstNode, SourceFile, SyntaxKind::*,
-    TextUnit, TextRange, SyntaxToken,
     algo::{find_node_at_offset, find_token_at_offset, TokenAtOffset},
     ast::{self, AstToken},
+    AstNode, SourceFile,
+    SyntaxKind::*,
+    SyntaxToken, TextRange, TextUnit,
 };
-use ra_fmt::leading_indent;
 use ra_text_edit::{TextEdit, TextEditBuilder};
-use ra_db::{FilePosition, SourceDatabase};
-use crate::{db::RootDatabase, SourceChange, SourceFileEdit};
 
 pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<SourceChange> {
     let file = db.parse(position.file_id).tree;
diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs
index 9095bee894..3851aadf24 100644
--- a/crates/ra_lsp_server/src/caps.rs
+++ b/crates/ra_lsp_server/src/caps.rs
@@ -1,8 +1,9 @@
 use lsp_types::{
-    CodeActionProviderCapability, CodeLensOptions, CompletionOptions, DocumentOnTypeFormattingOptions,
-    ExecuteCommandOptions, FoldingRangeProviderCapability, RenameOptions, RenameProviderCapability,
+    CodeActionProviderCapability, CodeLensOptions, CompletionOptions,
+    DocumentOnTypeFormattingOptions, ExecuteCommandOptions, FoldingRangeProviderCapability,
+    GenericCapability, ImplementationProviderCapability, RenameOptions, RenameProviderCapability,
     ServerCapabilities, SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind,
-    TextDocumentSyncOptions, ImplementationProviderCapability, GenericCapability, TypeDefinitionProviderCapability
+    TextDocumentSyncOptions, TypeDefinitionProviderCapability,
 };
 
 pub fn server_capabilities() -> ServerCapabilities {
diff --git a/crates/ra_lsp_server/src/cargo_target_spec.rs b/crates/ra_lsp_server/src/cargo_target_spec.rs
index 082ac8609c..050c5fd950 100644
--- a/crates/ra_lsp_server/src/cargo_target_spec.rs
+++ b/crates/ra_lsp_server/src/cargo_target_spec.rs
@@ -1,7 +1,7 @@
 use crate::{
     project_model::{self, TargetKind},
     world::WorldSnapshot,
-    Result
+    Result,
 };
 
 use ra_ide_api::{FileId, RunnableKind};
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 2574925895..c8128f55bd 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -1,13 +1,13 @@
 use lsp_types::{
-    self, CreateFile, Documentation, DocumentChangeOperation, DocumentChanges, Location, LocationLink,
-    MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier,
-    TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier,
-    WorkspaceEdit,
+    self, CreateFile, DocumentChangeOperation, DocumentChanges, Documentation, Location,
+    LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, SymbolKind,
+    TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem, TextDocumentPositionParams, Url,
+    VersionedTextDocumentIdentifier, WorkspaceEdit,
 };
 use ra_ide_api::{
-    CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit,
-    NavigationTarget, SourceChange, SourceFileEdit, RangeInfo,
-    LineCol, LineIndex, translate_offset_with_edit, InsertTextFormat
+    translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition,
+    FileRange, FileSystemEdit, InsertTextFormat, LineCol, LineIndex, NavigationTarget, RangeInfo,
+    SourceChange, SourceFileEdit,
 };
 use ra_syntax::{SyntaxKind, TextRange, TextUnit};
 use ra_text_edit::{AtomTextEdit, TextEdit};
diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs
index 14cfa401f5..56a263aa56 100644
--- a/crates/ra_lsp_server/src/lib.rs
+++ b/crates/ra_lsp_server/src/lib.rs
@@ -10,4 +10,7 @@ pub mod init;
 mod world;
 
 pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
-pub use crate::{caps::server_capabilities, main_loop::main_loop, main_loop::LspError, init::InitializationOptions};
+pub use crate::{
+    caps::server_capabilities, init::InitializationOptions, main_loop::main_loop,
+    main_loop::LspError,
+};
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 4aadb5ea87..6aa6dd49fb 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -1,8 +1,8 @@
-use serde::Deserialize;
 use flexi_logger::{Duplicate, Logger};
 use gen_lsp_server::{run_server, stdio_transport};
+use serde::Deserialize;
 
-use ra_lsp_server::{Result, InitializationOptions};
+use ra_lsp_server::{InitializationOptions, Result};
 use ra_prof;
 
 fn main() -> Result<()> {
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index aeb8a22992..cb73e65866 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -2,7 +2,7 @@ mod handlers;
 mod subscriptions;
 pub(crate) mod pending_requests;
 
-use std::{fmt, path::PathBuf, sync::Arc, time::Instant, error::Error};
+use std::{error::Error, fmt, path::PathBuf, sync::Arc, time::Instant};
 
 use crossbeam_channel::{select, unbounded, Receiver, RecvError, Sender};
 use gen_lsp_server::{
@@ -10,21 +10,20 @@ use gen_lsp_server::{
 };
 use lsp_types::NumberOrString;
 use ra_ide_api::{Canceled, FileId, LibraryData};
+use ra_prof::profile;
 use ra_vfs::VfsTask;
 use serde::{de::DeserializeOwned, Serialize};
 use threadpool::ThreadPool;
-use ra_prof::profile;
 
 use crate::{
     main_loop::{
+        pending_requests::{PendingRequest, PendingRequests},
         subscriptions::Subscriptions,
-        pending_requests::{PendingRequests, PendingRequest},
     },
     project_model::workspace_loader,
     req,
     world::{WorldSnapshot, WorldState},
-    Result,
-    InitializationOptions,
+    InitializationOptions, Result,
 };
 
 const THREADPOOL_SIZE: usize = 8;
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 47222cd0ac..bbbc93b1cb 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -1,22 +1,21 @@
-use std::{io::Write as _, fmt::Write as _};
+use std::{fmt::Write as _, io::Write as _};
 
 use gen_lsp_server::ErrorCode;
 use lsp_types::{
-    CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, CodeAction,
-    DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange,
-    FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent,
-    MarkupKind, Position, PrepareRenameResponse, Range,
-    RenameParams,SymbolInformation, TextDocumentIdentifier, TextEdit,
-    WorkspaceEdit,
+    CodeAction, CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity,
+    DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeKind,
+    FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, MarkupKind, Position,
+    PrepareRenameResponse, Range, RenameParams, SymbolInformation, TextDocumentIdentifier,
+    TextEdit, WorkspaceEdit,
 };
 use ra_ide_api::{
-    FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, Cancelable,
-    AssistId,
+    AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo,
+    RunnableKind, Severity,
 };
-use ra_syntax::{AstNode, SyntaxKind, TextUnit, TextRange};
 use ra_prof::profile;
+use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
 use rustc_hash::FxHashMap;
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
 use serde_json::to_value;
 use url_serde::Ser;
 
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs
index 7d6440fadc..1130d08de9 100644
--- a/crates/ra_lsp_server/src/project_model.rs
+++ b/crates/ra_lsp_server/src/project_model.rs
@@ -5,7 +5,7 @@ use thread_worker::Worker;
 use crate::Result;
 
 pub use ra_project_model::{
-    ProjectWorkspace, CargoWorkspace, Package, Target, TargetKind, Sysroot,
+    CargoWorkspace, Package, ProjectWorkspace, Sysroot, Target, TargetKind,
 };
 
 pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> {
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index 992c24eac3..27f2deb347 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -4,12 +4,11 @@ use serde::{Deserialize, Serialize};
 use url_serde;
 
 pub use lsp_types::{
-    notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, CodeLensParams,
-    CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams, DocumentSymbolParams,
-    DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult,
-    PublishDiagnosticsParams, ReferenceParams, SignatureHelp, TextDocumentEdit,
-    TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams,
-    MessageType, ShowMessageParams,
+    notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens,
+    CodeLensParams, CompletionParams, CompletionResponse, DocumentOnTypeFormattingParams,
+    DocumentSymbolParams, DocumentSymbolResponse, ExecuteCommandParams, Hover, InitializeResult,
+    MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams, SignatureHelp,
+    TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams,
 };
 
 pub enum AnalyzerStatus {}
diff --git a/crates/ra_lsp_server/src/vfs_filter.rs b/crates/ra_lsp_server/src/vfs_filter.rs
index dd20c12031..e16a57da56 100644
--- a/crates/ra_lsp_server/src/vfs_filter.rs
+++ b/crates/ra_lsp_server/src/vfs_filter.rs
@@ -1,6 +1,6 @@
-use std::path::PathBuf;
 use ra_project_model::ProjectRoot;
-use ra_vfs::{RootEntry, Filter, RelativePath};
+use ra_vfs::{Filter, RelativePath, RootEntry};
+use std::path::PathBuf;
 
 /// `IncludeRustFiles` is used to convert
 /// from `ProjectRoot` to `RootEntry` for VFS
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index 7822e1c1c5..fdc577622e 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -3,22 +3,20 @@ use std::{
     sync::Arc,
 };
 
+use gen_lsp_server::ErrorCode;
 use lsp_types::Url;
+use parking_lot::RwLock;
 use ra_ide_api::{
-    Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData,
-    SourceRootId
+    Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId,
 };
 use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot};
 use relative_path::RelativePathBuf;
-use parking_lot::RwLock;
-use gen_lsp_server::ErrorCode;
 
 use crate::{
     main_loop::pending_requests::{CompletedRequest, LatestRequests},
     project_model::ProjectWorkspace,
     vfs_filter::IncludeRustFiles,
-    Result,
-    LspError,
+    LspError, Result,
 };
 
 /// `WorldState` is the primary mutable state of the language server
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
index c146252a48..52c3d03b55 100644
--- a/crates/ra_mbe/src/lib.rs
+++ b/crates/ra_mbe/src/lib.rs
@@ -41,14 +41,8 @@ pub enum ExpandError {
 }
 
 pub use crate::syntax_bridge::{
-    ast_to_token_tree,
-    token_tree_to_ast_item_list,
-    syntax_node_to_token_tree,
-    token_tree_to_expr,
-    token_tree_to_pat,
-    token_tree_to_ty,
-    token_tree_to_macro_items,
-    token_tree_to_macro_stmts,
+    ast_to_token_tree, syntax_node_to_token_tree, token_tree_to_ast_item_list, token_tree_to_expr,
+    token_tree_to_macro_items, token_tree_to_macro_stmts, token_tree_to_pat, token_tree_to_ty,
 };
 
 /// This struct contains AST for a single `macro_rules` definition. What might
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
index 55a6ecf587..fbad8ebe2d 100644
--- a/crates/ra_mbe/src/mbe_expander.rs
+++ b/crates/ra_mbe/src/mbe_expander.rs
@@ -1,12 +1,12 @@
+use ra_syntax::SmolStr;
 /// This module takes a (parsed) definition of `macro_rules` invocation, a
 /// `tt::TokenTree` representing an argument of macro invocation, and produces a
 /// `tt::TokenTree` for the result of the expansion.
 use rustc_hash::FxHashMap;
-use ra_syntax::SmolStr;
 use tt::TokenId;
 
-use crate::ExpandError;
 use crate::tt_cursor::TtCursor;
+use crate::ExpandError;
 
 pub(crate) fn expand(
     rules: &crate::MacroRules,
diff --git a/crates/ra_mbe/src/mbe_parser.rs b/crates/ra_mbe/src/mbe_parser.rs
index dca16b5376..a298858520 100644
--- a/crates/ra_mbe/src/mbe_parser.rs
+++ b/crates/ra_mbe/src/mbe_parser.rs
@@ -1,8 +1,8 @@
+use crate::tt_cursor::TtCursor;
 /// This module parses a raw `tt::TokenStream` into macro-by-example token
 /// stream. This is a *mostly* identify function, expect for handling of
 /// `$var:tt_kind` and `$(repeat),*` constructs.
 use crate::ParseError;
-use crate::tt_cursor::TtCursor;
 
 pub(crate) fn parse(tt: &tt::Subtree) -> Result<crate::MacroRules, ParseError> {
     let mut parser = TtCursor::new(tt);
diff --git a/crates/ra_mbe/src/subtree_parser.rs b/crates/ra_mbe/src/subtree_parser.rs
index 4a6f6aa45f..5688e7f7fb 100644
--- a/crates/ra_mbe/src/subtree_parser.rs
+++ b/crates/ra_mbe/src/subtree_parser.rs
@@ -1,8 +1,8 @@
 use crate::subtree_source::SubtreeTokenSource;
 
 use ra_parser::{TokenSource, TreeSink};
-use ra_syntax::{SyntaxKind};
-use tt::buffer::{TokenBuffer, Cursor};
+use ra_syntax::SyntaxKind;
+use tt::buffer::{Cursor, TokenBuffer};
 
 struct OffsetTokenSink<'a> {
     cursor: Cursor<'a>,
diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs
index 7647e16d8c..2489c996bc 100644
--- a/crates/ra_mbe/src/subtree_source.rs
+++ b/crates/ra_mbe/src/subtree_source.rs
@@ -1,7 +1,7 @@
-use ra_parser::{TokenSource, Token};
+use ra_parser::{Token, TokenSource};
 use ra_syntax::{classify_literal, SmolStr, SyntaxKind, SyntaxKind::*, T};
-use std::cell::{RefCell, Cell};
-use tt::buffer::{TokenBuffer, Cursor};
+use std::cell::{Cell, RefCell};
+use tt::buffer::{Cursor, TokenBuffer};
 
 #[derive(Debug, Clone, Eq, PartialEq)]
 struct TtToken {
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index cb039ca376..b91b0e7a5a 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -1,11 +1,11 @@
-use ra_parser::{TreeSink, ParseError};
+use crate::subtree_source::SubtreeTokenSource;
+use crate::ExpandError;
+use ra_parser::{ParseError, TreeSink};
 use ra_syntax::{
-    AstNode, SyntaxNode, TextRange, SyntaxKind, SmolStr, SyntaxTreeBuilder, TreeArc, SyntaxElement,
-    ast, SyntaxKind::*, TextUnit, T
+    ast, AstNode, SmolStr, SyntaxElement, SyntaxKind, SyntaxKind::*, SyntaxNode, SyntaxTreeBuilder,
+    TextRange, TextUnit, TreeArc, T,
 };
-use tt::buffer::{TokenBuffer, Cursor};
-use crate::subtree_source::{SubtreeTokenSource};
-use crate::ExpandError;
+use tt::buffer::{Cursor, TokenBuffer};
 
 /// Maps `tt::TokenId` to the relative range of the original token.
 #[derive(Default)]
@@ -367,7 +367,7 @@ impl<'a> TreeSink for TtTreeSink<'a> {
 #[cfg(test)]
 mod tests {
     use super::*;
-    use crate::tests::{expand, create_rules};
+    use crate::tests::{create_rules, expand};
     use ra_parser::TokenSource;
 
     #[test]
diff --git a/crates/ra_mbe/src/tt_cursor.rs b/crates/ra_mbe/src/tt_cursor.rs
index d85ab43e40..503c77ef31 100644
--- a/crates/ra_mbe/src/tt_cursor.rs
+++ b/crates/ra_mbe/src/tt_cursor.rs
@@ -1,6 +1,6 @@
-use crate::ParseError;
 use crate::subtree_parser::Parser;
-use smallvec::{SmallVec, smallvec};
+use crate::ParseError;
+use smallvec::{smallvec, SmallVec};
 
 #[derive(Debug, Clone)]
 pub(crate) struct TtCursor<'a> {
diff --git a/crates/ra_parser/src/event.rs b/crates/ra_parser/src/event.rs
index 51beb08668..a7d06a815c 100644
--- a/crates/ra_parser/src/event.rs
+++ b/crates/ra_parser/src/event.rs
@@ -10,8 +10,9 @@
 use std::mem;
 
 use crate::{
-    ParseError, TreeSink,
+    ParseError,
     SyntaxKind::{self, *},
+    TreeSink,
 };
 
 /// `Parser` produces a flat list of `Event`s.
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index 5997636d62..6580340975 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -37,9 +37,9 @@ mod type_params;
 mod types;
 
 use crate::{
+    parser::{CompletedMarker, Marker, Parser},
     SyntaxKind::{self, *},
     TokenSet,
-    parser::{CompletedMarker, Marker, Parser},
 };
 
 pub(crate) fn root(p: &mut Parser) {
diff --git a/crates/ra_parser/src/parser.rs b/crates/ra_parser/src/parser.rs
index 8a2e253ac9..159ed50dfd 100644
--- a/crates/ra_parser/src/parser.rs
+++ b/crates/ra_parser/src/parser.rs
@@ -3,10 +3,10 @@ use std::cell::Cell;
 use drop_bomb::DropBomb;
 
 use crate::{
-    SyntaxKind::{self, ERROR, EOF, TOMBSTONE},
-    TokenSource, ParseError, TokenSet,
     event::Event,
-    T
+    ParseError,
+    SyntaxKind::{self, EOF, ERROR, TOMBSTONE},
+    TokenSet, TokenSource, T,
 };
 
 /// `Parser` struct provides the low-level API for
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs
index 6f79187456..919cc1b3ce 100644
--- a/crates/ra_prof/src/lib.rs
+++ b/crates/ra_prof/src/lib.rs
@@ -2,18 +2,21 @@ mod memory_usage;
 
 use std::{
     cell::RefCell,
-    time::{Duration, Instant},
-    mem,
+    collections::HashSet,
     io::{stderr, Write},
     iter::repeat,
-    collections::HashSet,
-    sync::{RwLock, atomic::{AtomicBool, Ordering}},
+    mem,
+    sync::{
+        atomic::{AtomicBool, Ordering},
+        RwLock,
+    },
+    time::{Duration, Instant},
 };
 
-use once_cell::sync::Lazy;
 use itertools::Itertools;
+use once_cell::sync::Lazy;
 
-pub use crate::memory_usage::{MemoryUsage, Bytes};
+pub use crate::memory_usage::{Bytes, MemoryUsage};
 
 // We use jemalloc mainly to get heap usage statistics, actual performance
 // difference is not measures.
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index d5ebf2c7a8..2b06e9e372 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -1,9 +1,9 @@
 use std::path::{Path, PathBuf};
 
-use cargo_metadata::{MetadataCommand, CargoOpt};
-use ra_arena::{Arena, RawId, impl_arena_id};
-use rustc_hash::FxHashMap;
+use cargo_metadata::{CargoOpt, MetadataCommand};
+use ra_arena::{impl_arena_id, Arena, RawId};
 use ra_db::Edition;
+use rustc_hash::FxHashMap;
 
 use crate::Result;
 
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 42156bea6f..74b7efa9ad 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -3,15 +3,15 @@ mod json_project;
 mod sysroot;
 
 use std::{
+    error::Error,
     fs::File,
     io::BufReader,
     path::{Path, PathBuf},
-    error::Error
 };
 
 use rustc_hash::FxHashMap;
 
-use ra_db::{CrateGraph, FileId, Edition};
+use ra_db::{CrateGraph, Edition, FileId};
 
 use serde_json::from_reader;
 
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs
index 9e0d8aaac7..a419b81e8b 100644
--- a/crates/ra_project_model/src/sysroot.rs
+++ b/crates/ra_project_model/src/sysroot.rs
@@ -3,7 +3,7 @@ use std::{
     process::Command,
 };
 
-use ra_arena::{Arena, RawId, impl_arena_id};
+use ra_arena::{impl_arena_id, Arena, RawId};
 
 use crate::Result;
 
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs
index d31d003433..fad8da1323 100644
--- a/crates/ra_syntax/src/algo.rs
+++ b/crates/ra_syntax/src/algo.rs
@@ -2,7 +2,7 @@ pub mod visit;
 
 use itertools::Itertools;
 
-use crate::{SyntaxNode, TextRange, TextUnit, AstNode, Direction, SyntaxToken, SyntaxElement};
+use crate::{AstNode, Direction, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextUnit};
 
 pub use rowan::TokenAtOffset;
 
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 319110b6a7..3dcf39f7e1 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -9,16 +9,16 @@ mod expr_extensions;
 use std::marker::PhantomData;
 
 use crate::{
-    syntax_node::{SyntaxNode, SyntaxNodeChildren, TreeArc, SyntaxToken},
+    syntax_node::{SyntaxNode, SyntaxNodeChildren, SyntaxToken, TreeArc},
     SmolStr,
 };
 
 pub use self::{
+    expr_extensions::{ArrayExprKind, BinOp, ElseBranch, LiteralKind, PrefixOp},
+    extensions::{FieldKind, PathSegmentKind, SelfParamKind, StructKind},
     generated::*,
-    traits::*,
     tokens::*,
-    extensions::{PathSegmentKind, StructKind,FieldKind, SelfParamKind},
-    expr_extensions::{ElseBranch, PrefixOp, BinOp, LiteralKind,ArrayExprKind},
+    traits::*,
 };
 
 /// The main trait to go from untyped `SyntaxNode`  to a typed ast. The
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs
index d88671d45e..87dbb0ea5e 100644
--- a/crates/ra_syntax/src/ast/expr_extensions.rs
+++ b/crates/ra_syntax/src/ast/expr_extensions.rs
@@ -1,10 +1,10 @@
 //! Various extension methods to ast Expr Nodes, which are hard to code-generate.
 
 use crate::{
-    SyntaxToken, SyntaxElement, SmolStr,
-    ast::{self, AstNode, AstChildren, children, child_opt},
+    ast::{self, child_opt, children, AstChildren, AstNode},
+    SmolStr, SyntaxElement,
     SyntaxKind::*,
-    T
+    SyntaxToken, T,
 };
 
 #[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 930b2d9fad..72a30232df 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -4,10 +4,10 @@
 use itertools::Itertools;
 
 use crate::{
-    SmolStr, SyntaxToken,
-    ast::{self, AstNode, children, child_opt},
+    ast::{self, child_opt, children, AstNode},
+    SmolStr, SyntaxElement,
     SyntaxKind::*,
-    SyntaxElement, T,
+    SyntaxToken, T,
 };
 use ra_parser::SyntaxKind;
 
diff --git a/crates/ra_syntax/src/ast/tokens.rs b/crates/ra_syntax/src/ast/tokens.rs
index 08882ea69b..be63b3c9e5 100644
--- a/crates/ra_syntax/src/ast/tokens.rs
+++ b/crates/ra_syntax/src/ast/tokens.rs
@@ -1,9 +1,9 @@
 //! There are many AstNodes, but only a few tokens, so we hand-write them here.
 
 use crate::{
-    SyntaxToken,
-    SyntaxKind::{COMMENT, WHITESPACE},
     ast::AstToken,
+    SyntaxKind::{COMMENT, WHITESPACE},
+    SyntaxToken,
 };
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -61,7 +61,7 @@ pub enum CommentPlacement {
 }
 
 const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
-    use {CommentShape::*, CommentPlacement::*};
+    use {CommentPlacement::*, CommentShape::*};
     &[
         ("///", CommentKind { shape: Line, doc: Some(Outer) }),
         ("//!", CommentKind { shape: Line, doc: Some(Inner) }),
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index 4334854008..29cb53e35b 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -5,8 +5,8 @@
 use itertools::Itertools;
 
 use crate::{
-    syntax_node::{SyntaxNodeChildren, SyntaxElementChildren},
-    ast::{self, child_opt, children, AstNode, AstToken, AstChildren},
+    ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
+    syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
 };
 
 pub trait TypeAscriptionOwner: AstNode {
diff --git a/crates/ra_syntax/src/fuzz.rs b/crates/ra_syntax/src/fuzz.rs
index 6a9905bd14..6d114aad40 100644
--- a/crates/ra_syntax/src/fuzz.rs
+++ b/crates/ra_syntax/src/fuzz.rs
@@ -1,4 +1,4 @@
-use crate::{SourceFile, validation, TextUnit, TextRange, AstNode};
+use crate::{validation, AstNode, SourceFile, TextRange, TextUnit};
 use ra_text_edit::AtomTextEdit;
 use std::str::{self, FromStr};
 
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index e46ad12dbf..9790a984d5 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -31,23 +31,26 @@ pub mod ast;
 #[doc(hidden)]
 pub mod fuzz;
 
-use std::{sync::Arc, fmt::Write};
+use std::{fmt::Write, sync::Arc};
 
 use ra_text_edit::AtomTextEdit;
 
 use crate::syntax_node::GreenNode;
 
-pub use rowan::{SmolStr, TextRange, TextUnit};
-pub use ra_parser::SyntaxKind;
-pub use ra_parser::T;
 pub use crate::{
     ast::AstNode,
-    syntax_error::{SyntaxError, SyntaxErrorKind, Location},
+    parsing::{classify_literal, tokenize, Token},
+    ptr::{AstPtr, SyntaxNodePtr},
+    syntax_error::{Location, SyntaxError, SyntaxErrorKind},
+    syntax_node::{
+        Direction, InsertPosition, SyntaxElement, SyntaxNode, SyntaxToken, SyntaxTreeBuilder,
+        TreeArc, WalkEvent,
+    },
     syntax_text::SyntaxText,
-    syntax_node::{Direction,  SyntaxNode, WalkEvent, TreeArc, SyntaxTreeBuilder, SyntaxElement, SyntaxToken, InsertPosition},
-    ptr::{SyntaxNodePtr, AstPtr},
-    parsing::{tokenize, classify_literal, Token},
 };
+pub use ra_parser::SyntaxKind;
+pub use ra_parser::T;
+pub use rowan::{SmolStr, TextRange, TextUnit};
 
 /// `Parse` is the result of the parsing: a syntax tree and a collection of
 /// errors.
diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs
index 4c1fa6c4f3..0387f03780 100644
--- a/crates/ra_syntax/src/parsing.rs
+++ b/crates/ra_syntax/src/parsing.rs
@@ -6,12 +6,9 @@ mod text_token_source;
 mod text_tree_sink;
 mod reparsing;
 
-use crate::{
-    SyntaxError,
-    syntax_node::GreenNode,
-};
+use crate::{syntax_node::GreenNode, SyntaxError};
 
-pub use self::lexer::{tokenize, classify_literal, Token};
+pub use self::lexer::{classify_literal, tokenize, Token};
 
 pub(crate) use self::reparsing::incremental_reparse;
 
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs
index 6eb96f03da..60cf37047d 100644
--- a/crates/ra_syntax/src/parsing/lexer.rs
+++ b/crates/ra_syntax/src/parsing/lexer.rs
@@ -6,8 +6,7 @@ mod strings;
 
 use crate::{
     SyntaxKind::{self, *},
-    TextUnit,
-    T,
+    TextUnit, T,
 };
 
 use self::{
diff --git a/crates/ra_syntax/src/parsing/lexer/numbers.rs b/crates/ra_syntax/src/parsing/lexer/numbers.rs
index 874fb8b320..e53ae231b3 100644
--- a/crates/ra_syntax/src/parsing/lexer/numbers.rs
+++ b/crates/ra_syntax/src/parsing/lexer/numbers.rs
@@ -1,7 +1,4 @@
-use crate::parsing::lexer::{
-    ptr::Ptr,
-    classes::*,
-};
+use crate::parsing::lexer::{classes::*, ptr::Ptr};
 
 use crate::SyntaxKind::{self, *};
 
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index cf27a33934..eeca94020d 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -6,19 +6,20 @@
 //!   - otherwise, we search for the nearest `{}` block which contains the edit
 //!     and try to parse only this block.
 
-use ra_text_edit::AtomTextEdit;
 use ra_parser::Reparser;
+use ra_text_edit::AtomTextEdit;
 
 use crate::{
-    SyntaxKind::*, TextRange, TextUnit, SyntaxError,
     algo,
-    syntax_node::{GreenNode, SyntaxNode, GreenToken, SyntaxElement},
     parsing::{
+        lexer::{tokenize, Token},
         text_token_source::TextTokenSource,
         text_tree_sink::TextTreeSink,
-        lexer::{tokenize, Token},
     },
-    T,
+    syntax_node::{GreenNode, GreenToken, SyntaxElement, SyntaxNode},
+    SyntaxError,
+    SyntaxKind::*,
+    TextRange, TextUnit, T,
 };
 
 pub(crate) fn incremental_reparse(
@@ -168,10 +169,10 @@ fn merge_errors(
 mod tests {
     use std::sync::Arc;
 
-    use test_utils::{extract_range, assert_eq_text};
+    use test_utils::{assert_eq_text, extract_range};
 
-    use crate::{SourceFile, AstNode, Parse};
     use super::*;
+    use crate::{AstNode, Parse, SourceFile};
 
     fn do_check(before: &str, replace_with: &str, reparsed_len: u32) {
         let (range, before) = extract_range(before);
diff --git a/crates/ra_syntax/src/parsing/text_token_source.rs b/crates/ra_syntax/src/parsing/text_token_source.rs
index 71d2947f77..f592b499fd 100644
--- a/crates/ra_syntax/src/parsing/text_token_source.rs
+++ b/crates/ra_syntax/src/parsing/text_token_source.rs
@@ -1,10 +1,7 @@
-use ra_parser::TokenSource;
 use ra_parser::Token as PToken;
+use ra_parser::TokenSource;
 
-use crate::{
-    SyntaxKind::EOF, TextRange, TextUnit,
-    parsing::lexer::Token,
-};
+use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextUnit};
 
 pub(crate) struct TextTokenSource<'t> {
     text: &'t str,
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index 71fc515f2e..bf1b35c95a 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -1,12 +1,13 @@
 use std::mem;
 
-use ra_parser::{TreeSink, ParseError};
+use ra_parser::{ParseError, TreeSink};
 
 use crate::{
-    SmolStr, SyntaxError, TextUnit, TextRange, SyntaxTreeBuilder,
-    SyntaxKind::{self, *},
     parsing::Token,
     syntax_node::GreenNode,
+    SmolStr, SyntaxError,
+    SyntaxKind::{self, *},
+    SyntaxTreeBuilder, TextRange, TextUnit,
 };
 
 /// Bridges the parser with our specific syntax tree representation.
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs
index 10cddb8528..0550dca1a1 100644
--- a/crates/ra_syntax/src/ptr.rs
+++ b/crates/ra_syntax/src/ptr.rs
@@ -1,10 +1,5 @@
-use std::{
-    marker::PhantomData,
-    iter::successors,
-};
-use crate::{
-    AstNode, SyntaxKind, SyntaxNode, TextRange,
-};
+use crate::{AstNode, SyntaxKind, SyntaxNode, TextRange};
+use std::{iter::successors, marker::PhantomData};
 
 /// A pointer to a syntax node inside a file. It can be used to remember a
 /// specific node across reparses of the same file.
diff --git a/crates/ra_syntax/src/syntax_error.rs b/crates/ra_syntax/src/syntax_error.rs
index d29c0cf6c7..5aefec768f 100644
--- a/crates/ra_syntax/src/syntax_error.rs
+++ b/crates/ra_syntax/src/syntax_error.rs
@@ -2,10 +2,7 @@ use std::fmt;
 
 use ra_parser::ParseError;
 
-use crate::{
-    TextRange, TextUnit,
-    validation::EscapeError,
-};
+use crate::{validation::EscapeError, TextRange, TextUnit};
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
 pub struct SyntaxError {
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs
index 4105b52209..80c8639c8f 100644
--- a/crates/ra_syntax/src/syntax_node.rs
+++ b/crates/ra_syntax/src/syntax_node.rs
@@ -7,18 +7,18 @@
 //! modules just wraps its API.
 
 use std::{
-    ops::RangeInclusive,
-    fmt::{self, Write},
     borrow::Borrow,
+    fmt::{self, Write},
     iter::successors,
+    ops::RangeInclusive,
 };
 
 use ra_parser::ParseError;
-use rowan::{TransparentNewType, GreenNodeBuilder};
+use rowan::{GreenNodeBuilder, TransparentNewType};
 
 use crate::{
-    SmolStr, SyntaxKind, TextUnit, TextRange, SyntaxText, SourceFile, AstNode, SyntaxNodePtr,
     syntax_error::{SyntaxError, SyntaxErrorKind},
+    AstNode, SmolStr, SourceFile, SyntaxKind, SyntaxNodePtr, SyntaxText, TextRange, TextUnit,
 };
 
 pub use rowan::WalkEvent;
diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs
index c9038cd5c0..e648dc082d 100644
--- a/crates/ra_syntax/src/syntax_text.rs
+++ b/crates/ra_syntax/src/syntax_text.rs
@@ -1,6 +1,9 @@
-use std::{fmt, ops::{self, Bound}};
+use std::{
+    fmt,
+    ops::{self, Bound},
+};
 
-use crate::{SmolStr, SyntaxNode, TextRange, TextUnit, SyntaxElement};
+use crate::{SmolStr, SyntaxElement, SyntaxNode, TextRange, TextUnit};
 
 #[derive(Clone)]
 pub struct SyntaxText<'a> {
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index b53900a4bb..87522ec181 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -4,11 +4,10 @@ mod block;
 mod field_expr;
 
 use crate::{
-    SourceFile, SyntaxError, AstNode, SyntaxNode, TextUnit,
-    SyntaxKind::{BYTE, BYTE_STRING, STRING, CHAR},
-    ast,
     algo::visit::{visitor_ctx, VisitorCtx},
-    T,
+    ast, AstNode, SourceFile, SyntaxError,
+    SyntaxKind::{BYTE, BYTE_STRING, CHAR, STRING},
+    SyntaxNode, TextUnit, T,
 };
 
 pub(crate) use unescape::EscapeError;
diff --git a/crates/ra_syntax/src/validation/block.rs b/crates/ra_syntax/src/validation/block.rs
index f2cf3cbbd8..46650d9b0b 100644
--- a/crates/ra_syntax/src/validation/block.rs
+++ b/crates/ra_syntax/src/validation/block.rs
@@ -1,7 +1,8 @@
-use crate::{SyntaxKind::*,
-    ast::{self, AttrsOwner, AstNode},
+use crate::{
+    ast::{self, AstNode, AttrsOwner},
     SyntaxError,
     SyntaxErrorKind::*,
+    SyntaxKind::*,
 };
 
 pub(crate) fn validate_block_node(node: &ast::Block, errors: &mut Vec<SyntaxError>) {
diff --git a/crates/ra_syntax/src/validation/field_expr.rs b/crates/ra_syntax/src/validation/field_expr.rs
index 2b405062e2..d3020edf78 100644
--- a/crates/ra_syntax/src/validation/field_expr.rs
+++ b/crates/ra_syntax/src/validation/field_expr.rs
@@ -1,6 +1,7 @@
-use crate::{ast::{self, FieldKind},
-            SyntaxError,
-            SyntaxErrorKind::*,
+use crate::{
+    ast::{self, FieldKind},
+    SyntaxError,
+    SyntaxErrorKind::*,
 };
 
 pub(crate) fn validate_field_expr_node(node: &ast::FieldExpr, errors: &mut Vec<SyntaxError>) {
diff --git a/crates/ra_syntax/src/validation/unescape.rs b/crates/ra_syntax/src/validation/unescape.rs
index 91dbcfae87..4c3a7effc0 100644
--- a/crates/ra_syntax/src/validation/unescape.rs
+++ b/crates/ra_syntax/src/validation/unescape.rs
@@ -7,8 +7,8 @@
 //!
 //! Hopefully, we'll share this code in a proper way some day
 
-use std::str::Chars;
 use std::ops::Range;
+use std::str::Chars;
 
 #[derive(Debug, PartialEq, Eq, Clone, Hash)]
 pub enum EscapeError {
diff --git a/crates/ra_tools/src/bin/pre-commit.rs b/crates/ra_tools/src/bin/pre-commit.rs
index 95bb55cae9..a628f64b24 100644
--- a/crates/ra_tools/src/bin/pre-commit.rs
+++ b/crates/ra_tools/src/bin/pre-commit.rs
@@ -1,6 +1,6 @@
 use std::process::Command;
 
-use ra_tools::{Result, run_rustfmt, run, project_root, Overwrite};
+use ra_tools::{project_root, run, run_rustfmt, Overwrite, Result};
 
 fn main() -> Result<()> {
     run_rustfmt(Overwrite)?;
diff --git a/crates/ra_tools/src/lib.rs b/crates/ra_tools/src/lib.rs
index 821209567d..d56e0d2efd 100644
--- a/crates/ra_tools/src/lib.rs
+++ b/crates/ra_tools/src/lib.rs
@@ -1,10 +1,10 @@
 use std::{
-    fs,
     collections::HashMap,
+    error::Error,
+    fs,
+    io::{Error as IoError, ErrorKind},
     path::{Path, PathBuf},
     process::{Command, Output, Stdio},
-    io::{Error as IoError, ErrorKind},
-    error::Error
 };
 
 use itertools::Itertools;
diff --git a/crates/ra_tools/src/main.rs b/crates/ra_tools/src/main.rs
index 846e0223e0..7ed592f71c 100644
--- a/crates/ra_tools/src/main.rs
+++ b/crates/ra_tools/src/main.rs
@@ -1,10 +1,10 @@
 use clap::{App, SubCommand};
 use core::str;
 use ra_tools::{
-    generate, gen_tests, install_format_hook, run, run_with_output, run_rustfmt,
-    Overwrite, Result, run_fuzzer, run_clippy,
+    gen_tests, generate, install_format_hook, run, run_clippy, run_fuzzer, run_rustfmt,
+    run_with_output, Overwrite, Result,
 };
-use std::{path::{PathBuf}, env};
+use std::{env, path::PathBuf};
 
 fn main() -> Result<()> {
     let matches = App::new("tasks")
diff --git a/crates/ra_tt/src/buffer.rs b/crates/ra_tt/src/buffer.rs
index 5659aeae8b..48c22a2d8a 100644
--- a/crates/ra_tt/src/buffer.rs
+++ b/crates/ra_tt/src/buffer.rs
@@ -1,4 +1,4 @@
-use crate::{TokenTree, Subtree};
+use crate::{Subtree, TokenTree};
 
 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
 struct EntryId(usize);
diff --git a/rustfmt.toml b/rustfmt.toml
index 63d651a85f..71007de81b 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,3 +1,2 @@
-reorder_imports = false
 reorder_modules = false
 use_small_heuristics = "Max"


Test patch:
diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs
index 07b533e290..953610b370 100644
--- a/crates/ra_hir/src/nameres/tests.rs
+++ b/crates/ra_hir/src/nameres/tests.rs
@@ -5,14 +5,14 @@ mod primitives;
 
 use std::sync::Arc;
 
+use insta::assert_snapshot_matches;
 use ra_db::SourceDatabase;
 use test_utils::covers;
-use insta::assert_snapshot_matches;
 
 use crate::{
-    Crate, Either,
-    mock::{MockDatabase, CrateGraphFixture},
+    mock::{CrateGraphFixture, MockDatabase},
     nameres::Resolution,
+    Crate, Either,
 };
 
 use super::*;
@@ -338,32 +338,6 @@ fn module_resolution_works_for_non_standard_filenames() {
     "###);
 }
 
-#[test]
-fn module_resolution_works_for_raw_modules() {
-    let map = def_map_with_crate_graph(
-        "
-        //- /library.rs
-        mod r#async;
-        use self::r#async::Bar;
-
-        //- /async.rs
-        pub struct Bar;
-        ",
-        crate_graph! {
-            "library": ("/library.rs", []),
-        },
-    );
-
-    assert_snapshot_matches!(map, @r###"
-        ⋮crate
-        ⋮Bar: t v
-        ⋮async: t
-        ⋮
-        ⋮crate::async
-        ⋮Bar: t v
-    "###);
-}
-
 #[test]
 fn name_res_works_for_broken_modules() {
     covers!(name_res_works_for_broken_modules);
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 0fe7805e24..20fa74fb43 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -1,17 +1,18 @@
-use std::sync::Arc;
 use std::fmt::Write;
+use std::sync::Arc;
 
 use insta::assert_snapshot_matches;
 
-use ra_db::{SourceDatabase, salsa::Database, FilePosition};
-use ra_syntax::{algo, ast::{self, AstNode}, SyntaxKind::*};
+use ra_db::{salsa::Database, FilePosition, SourceDatabase};
+use ra_syntax::{
+    algo,
+    ast::{self, AstNode},
+    SyntaxKind::*,
+};
 use test_utils::covers;
 
 use crate::{
-    mock::MockDatabase,
-    ty::display::HirDisplay,
-    ty::InferenceResult,
-    expr::BodySourceMap,
+    expr::BodySourceMap, mock::MockDatabase, ty::display::HirDisplay, ty::InferenceResult,
     SourceAnalyzer,
 };
 
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index 40d825893e..d271b02fc5 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -1,16 +1,14 @@
 mod support;
 
-use std::{
-    collections::HashMap,
-    time::Instant,
-};
+use std::{collections::HashMap, time::Instant};
 
 use lsp_types::{
-    CodeActionContext, DocumentFormattingParams, FormattingOptions, Position, Range, DidOpenTextDocumentParams, TextDocumentItem, TextDocumentPositionParams
+    CodeActionContext, DidOpenTextDocumentParams, DocumentFormattingParams, FormattingOptions,
+    Position, Range, TextDocumentItem, TextDocumentPositionParams,
 };
 use ra_lsp_server::req::{
-    CodeActionParams, CodeActionRequest, Formatting, Runnables, RunnablesParams, CompletionParams, Completion,
-    DidOpenTextDocument, OnEnter,
+    CodeActionParams, CodeActionRequest, Completion, CompletionParams, DidOpenTextDocument,
+    Formatting, OnEnter, Runnables, RunnablesParams,
 };
 use serde_json::json;
 use tempfile::TempDir;
diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs
index 75912afdd4..a5e352da15 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/support.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs
@@ -11,20 +11,17 @@ use flexi_logger::Logger;
 use gen_lsp_server::{RawMessage, RawNotification, RawRequest};
 use lsp_types::{
     notification::DidOpenTextDocument,
+    notification::{Notification, ShowMessage},
     request::{Request, Shutdown},
     DidOpenTextDocumentParams, TextDocumentIdentifier, TextDocumentItem, Url,
-    notification::{Notification, ShowMessage},
 };
 use serde::Serialize;
 use serde_json::{to_string_pretty, Value};
 use tempfile::TempDir;
+use test_utils::{find_mismatch, parse_fixture};
 use thread_worker::Worker;
-use test_utils::{parse_fixture, find_mismatch};
 
-use ra_lsp_server::{
-    main_loop, req,
-    InitializationOptions,
-};
+use ra_lsp_server::{main_loop, req, InitializationOptions};
 
 pub struct Project<'a> {
     fixture: &'a str,
diff --git a/crates/ra_syntax/tests/test.rs b/crates/ra_syntax/tests/test.rs
index f31e12588e..2442c85058 100644
--- a/crates/ra_syntax/tests/test.rs
+++ b/crates/ra_syntax/tests/test.rs
@@ -4,11 +4,11 @@ extern crate walkdir;
 
 use std::{
     fmt::Write,
-    path::{PathBuf, Component},
+    path::{Component, PathBuf},
 };
 
-use test_utils::{project_dir, dir_tests, read_text, collect_tests};
-use ra_syntax::{SourceFile, fuzz};
+use ra_syntax::{fuzz, SourceFile};
+use test_utils::{collect_tests, dir_tests, project_dir, read_text};
 
 #[test]
 fn lexer_tests() {
diff --git a/crates/ra_text_edit/src/test_utils.rs b/crates/ra_text_edit/src/test_utils.rs
index 2dc0e71af2..2d6e7f2163 100644
--- a/crates/ra_text_edit/src/test_utils.rs
+++ b/crates/ra_text_edit/src/test_utils.rs
@@ -1,6 +1,6 @@
-use proptest::prelude::*;
-use text_unit::{TextUnit, TextRange};
 use crate::{AtomTextEdit, TextEdit};
+use proptest::prelude::*;
+use text_unit::{TextRange, TextUnit};
 
 pub fn arb_text() -> proptest::string::RegexGeneratorStrategy<String> {
     // generate multiple newlines
diff --git a/crates/ra_tools/tests/cli.rs b/crates/ra_tools/tests/cli.rs
index 83640218f7..ae0eb337d2 100644
--- a/crates/ra_tools/tests/cli.rs
+++ b/crates/ra_tools/tests/cli.rs
@@ -1,6 +1,6 @@
 use walkdir::WalkDir;
 
-use ra_tools::{generate, gen_tests, run_rustfmt, Verify, project_root};
+use ra_tools::{gen_tests, generate, project_root, run_rustfmt, Verify};
 
 #[test]
 fn generated_grammar_is_fresh() {
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs
index 8bb3b3937f..ea99ac0629 100644
--- a/crates/test_utils/src/lib.rs
+++ b/crates/test_utils/src/lib.rs
@@ -3,11 +3,11 @@ pub mod marks;
 
 use std::{
     fs,
-    path::{Path, PathBuf}
+    path::{Path, PathBuf},
 };
 
-use text_unit::{TextRange, TextUnit};
 use serde_json::Value;
+use text_unit::{TextRange, TextUnit};
 
 pub use difference::Changeset as __Changeset;