From 1834bae5b86c54ed9dece26e82436919d59e6cb7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 4 Jul 2019 23:05:17 +0300 Subject: 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 --- crates/ra_syntax/src/parsing/lexer.rs | 3 +-- crates/ra_syntax/src/parsing/lexer/numbers.rs | 5 +---- crates/ra_syntax/src/parsing/reparsing.rs | 15 ++++++++------- crates/ra_syntax/src/parsing/text_token_source.rs | 7 ++----- crates/ra_syntax/src/parsing/text_tree_sink.rs | 7 ++++--- 5 files changed, 16 insertions(+), 21 deletions(-) (limited to 'crates/ra_syntax/src/parsing') diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index 6eb96f03d..60cf37047 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 874fb8b32..e53ae231b 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 cf27a3393..eeca94020 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 71d2947f7..f592b499f 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 71fc515f2..bf1b35c95 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. -- cgit v1.2.3