Skip to content

Commit 1834bae

Browse files
committed
allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was broken in the last rustfmt release, and syntax highlighting of imports is more important anyway
1 parent 2b2cd82 commit 1834bae

File tree

166 files changed

+772
-788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+772
-788
lines changed

crates/gen_lsp_server/examples/01_gen_lsp_server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::error::Error;
22

3-
use crossbeam_channel::{Sender, Receiver};
3+
use crossbeam_channel::{Receiver, Sender};
4+
use gen_lsp_server::{handle_shutdown, run_server, stdio_transport, RawMessage, RawResponse};
45
use lsp_types::{
5-
ServerCapabilities, InitializeParams,
66
request::{GotoDefinition, GotoDefinitionResponse},
7+
InitializeParams, ServerCapabilities,
78
};
8-
use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse};
99

1010
fn main() -> Result<(), Box<dyn Error + Sync + Send>> {
1111
let (receiver, sender, io_threads) = stdio_transport();

crates/gen_lsp_server/examples/02_gen_lsp_server_with_logging.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
4545
use std::error::Error;
4646

47-
use crossbeam_channel::{Sender, Receiver};
48-
use lsp_types::{
49-
ServerCapabilities, InitializeParams,
50-
request::{GotoDefinition, GotoDefinitionResponse},
47+
use crossbeam_channel::{Receiver, Sender};
48+
use gen_lsp_server::{
49+
handle_shutdown, run_server, stdio_transport, RawMessage, RawRequest, RawResponse,
5150
};
5251
use log::info;
53-
use gen_lsp_server::{
54-
run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse, RawRequest,
52+
use lsp_types::{
53+
request::{GotoDefinition, GotoDefinitionResponse},
54+
InitializeParams, ServerCapabilities,
5555
};
5656

5757
fn main() -> Result<(), Box<dyn Error + Sync + Send>> {

crates/ra_arena/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
33
use std::{
44
fmt,
5+
iter::FromIterator,
56
marker::PhantomData,
67
ops::{Index, IndexMut},
7-
iter::FromIterator,
88
};
99

1010
pub mod map;

crates/ra_assists/src/add_derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use hir::db::HirDatabase;
22
use ra_syntax::{
33
ast::{self, AstNode, AttrsOwner},
4-
SyntaxKind::{WHITESPACE, COMMENT},
4+
SyntaxKind::{COMMENT, WHITESPACE},
55
TextUnit,
66
};
77

8-
use crate::{AssistCtx, Assist, AssistId};
8+
use crate::{Assist, AssistCtx, AssistId};
99

1010
pub(crate) fn add_derive(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
1111
let nominal = ctx.node_at_offset::<ast::NominalDef>()?;

crates/ra_assists/src/add_explicit_type.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
use hir::{
2-
HirDisplay, Ty,
3-
db::HirDatabase,
4-
};
1+
use hir::{db::HirDatabase, HirDisplay, Ty};
52
use ra_syntax::{
3+
ast::{AstNode, LetStmt, NameOwner, PatKind},
64
T,
7-
ast::{LetStmt, PatKind, NameOwner, AstNode}
85
};
96

10-
use crate::{AssistCtx, Assist, AssistId};
7+
use crate::{Assist, AssistCtx, AssistId};
118

129
/// Add explicit type assist.
1310
pub(crate) fn add_explicit_type(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
@@ -56,7 +53,7 @@ fn is_unknown(ty: &Ty) -> bool {
5653
mod tests {
5754
use super::*;
5855

59-
use crate::helpers::{ check_assist, check_assist_target, check_assist_not_applicable };
56+
use crate::helpers::{check_assist, check_assist_not_applicable, check_assist_target};
6057

6158
#[test]
6259
fn add_explicit_type_target() {

crates/ra_assists/src/add_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use join_to_string::join;
21
use hir::db::HirDatabase;
2+
use join_to_string::join;
33
use ra_syntax::{
44
ast::{self, AstNode, NameOwner, TypeParamsOwner},
55
TextUnit,
66
};
77

8-
use crate::{AssistCtx, Assist, AssistId};
8+
use crate::{Assist, AssistCtx, AssistId};
99

1010
pub(crate) fn add_impl(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
1111
let nominal = ctx.node_at_offset::<ast::NominalDef>()?;

crates/ra_assists/src/add_missing_impl_members.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
use crate::{Assist, AssistId, AssistCtx, ast_editor::{AstEditor, AstBuilder}};
1+
use crate::{
2+
ast_editor::{AstBuilder, AstEditor},
3+
Assist, AssistCtx, AssistId,
4+
};
25

3-
use hir::{HasSource, db::HirDatabase};
4-
use ra_syntax::{SmolStr, TreeArc};
5-
use ra_syntax::ast::{self, AstNode, ImplItem, ImplItemKind, NameOwner};
6+
use hir::{db::HirDatabase, HasSource};
67
use ra_db::FilePosition;
8+
use ra_syntax::ast::{self, AstNode, ImplItem, ImplItemKind, NameOwner};
9+
use ra_syntax::{SmolStr, TreeArc};
710

811
#[derive(PartialEq)]
912
enum AddMissingImplMembersMode {

crates/ra_assists/src/assist_ctx.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use hir::db::HirDatabase;
2-
use ra_text_edit::TextEditBuilder;
32
use ra_db::FileRange;
3+
use ra_fmt::{leading_indent, reindent};
44
use ra_syntax::{
5-
SourceFile, TextRange, AstNode, TextUnit, SyntaxNode, SyntaxElement, SyntaxToken,
6-
algo::{find_token_at_offset, find_node_at_offset, find_covering_element, TokenAtOffset},
5+
algo::{find_covering_element, find_node_at_offset, find_token_at_offset, TokenAtOffset},
6+
AstNode, SourceFile, SyntaxElement, SyntaxNode, SyntaxToken, TextRange, TextUnit,
77
};
8-
use ra_fmt::{leading_indent, reindent};
8+
use ra_text_edit::TextEditBuilder;
99

10-
use crate::{AssistLabel, AssistAction, AssistId};
10+
use crate::{AssistAction, AssistId, AssistLabel};
1111

1212
#[derive(Clone, Debug)]
1313
pub(crate) enum Assist {

crates/ra_assists/src/ast_editor.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use std::{iter, ops::RangeInclusive};
22

33
use arrayvec::ArrayVec;
4-
use ra_text_edit::TextEditBuilder;
5-
use ra_syntax::{AstNode, TreeArc, ast, SyntaxKind::*, SyntaxElement, SourceFile, InsertPosition, Direction, T};
6-
use ra_fmt::leading_indent;
74
use hir::Name;
5+
use ra_fmt::leading_indent;
6+
use ra_syntax::{
7+
ast, AstNode, Direction, InsertPosition, SourceFile, SyntaxElement, SyntaxKind::*, TreeArc, T,
8+
};
9+
use ra_text_edit::TextEditBuilder;
810

911
pub struct AstEditor<N: AstNode> {
1012
original_ast: TreeArc<N>,
@@ -283,7 +285,7 @@ fn ast_node_from_file_text<N: AstNode>(text: &str) -> TreeArc<N> {
283285

284286
mod tokens {
285287
use once_cell::sync::Lazy;
286-
use ra_syntax::{AstNode, SourceFile, TreeArc, SyntaxToken, SyntaxKind::*, T};
288+
use ra_syntax::{AstNode, SourceFile, SyntaxKind::*, SyntaxToken, TreeArc, T};
287289

288290
static SOURCE_FILE: Lazy<TreeArc<SourceFile>> = Lazy::new(|| SourceFile::parse(",\n; ;").tree);
289291

crates/ra_assists/src/auto_import.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
use hir::{self, db::HirDatabase};
12
use ra_text_edit::TextEditBuilder;
2-
use hir::{ self, db::HirDatabase};
33

4-
use ra_syntax::{
5-
T,
6-
ast::{ self, NameOwner }, AstNode, SyntaxNode, Direction, TextRange, SmolStr,
7-
SyntaxKind::{ PATH, PATH_SEGMENT }
8-
};
94
use crate::{
5+
assist_ctx::{Assist, AssistCtx},
106
AssistId,
11-
assist_ctx::{AssistCtx, Assist},
7+
};
8+
use ra_syntax::{
9+
ast::{self, NameOwner},
10+
AstNode, Direction, SmolStr,
11+
SyntaxKind::{PATH, PATH_SEGMENT},
12+
SyntaxNode, TextRange, T,
1213
};
1314

1415
fn collect_path_segments_raw<'a>(
@@ -577,7 +578,7 @@ pub(crate) fn auto_import(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
577578
#[cfg(test)]
578579
mod tests {
579580
use super::*;
580-
use crate::helpers::{ check_assist, check_assist_not_applicable };
581+
use crate::helpers::{check_assist, check_assist_not_applicable};
581582

582583
#[test]
583584
fn test_auto_import_add_use_no_anchor() {

0 commit comments

Comments
 (0)