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_mbe/src/lib.rs | 10 ++-------- crates/ra_mbe/src/mbe_expander.rs | 4 ++-- crates/ra_mbe/src/mbe_parser.rs | 2 +- crates/ra_mbe/src/subtree_parser.rs | 4 ++-- crates/ra_mbe/src/subtree_source.rs | 6 +++--- crates/ra_mbe/src/syntax_bridge.rs | 14 +++++++------- crates/ra_mbe/src/tt_cursor.rs | 4 ++-- 7 files changed, 19 insertions(+), 25 deletions(-) (limited to 'crates/ra_mbe') diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index c146252a4..52c3d03b5 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 55a6ecf58..fbad8ebe2 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 dca16b537..a29885852 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 { 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 4a6f6aa45..5688e7f7f 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 7647e16d8..2489c996b 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 cb039ca37..b91b0e7a5 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 d85ab43e4..503c77ef3 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> { -- cgit v1.2.3