diff options
Diffstat (limited to 'src/libsyntax/util')
| -rw-r--r-- | src/libsyntax/util/lev_distance.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/util/node_count.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/util/parser.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 15 |
4 files changed, 23 insertions, 22 deletions
diff --git a/src/libsyntax/util/lev_distance.rs b/src/libsyntax/util/lev_distance.rs index d6d2251b5bc..c989fc7a5b8 100644 --- a/src/libsyntax/util/lev_distance.rs +++ b/src/libsyntax/util/lev_distance.rs @@ -1,5 +1,5 @@ use std::cmp; -use symbol::Symbol; +use crate::symbol::Symbol; /// Find the Levenshtein distance between two strings pub fn lev_distance(a: &str, b: &str) -> usize { @@ -101,7 +101,7 @@ fn test_lev_distance() { #[test] fn test_find_best_match_for_name() { - use with_globals; + use crate::with_globals; with_globals(|| { let input = vec![Symbol::intern("aaab"), Symbol::intern("aaabc")]; assert_eq!( diff --git a/src/libsyntax/util/node_count.rs b/src/libsyntax/util/node_count.rs index 7dd213ae38b..521edac8f5f 100644 --- a/src/libsyntax/util/node_count.rs +++ b/src/libsyntax/util/node_count.rs @@ -1,7 +1,7 @@ // Simply gives a rought count of the number of nodes in an AST. -use visit::*; -use ast::*; +use crate::visit::*; +use crate::ast::*; use syntax_pos::Span; pub struct NodeCounter { @@ -69,7 +69,7 @@ impl<'ast> Visitor<'ast> for NodeCounter { self.count += 1; walk_generics(self, g) } - fn visit_fn(&mut self, fk: FnKind, fd: &FnDecl, s: Span, _: NodeId) { + fn visit_fn(&mut self, fk: FnKind<'_>, fd: &FnDecl, s: Span, _: NodeId) { self.count += 1; walk_fn(self, fk, fd, s) } diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index 89d4e53b8d1..61729a08060 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -1,6 +1,6 @@ -use parse::token::{Token, BinOpToken}; -use symbol::keywords; -use ast::{self, BinOpKind}; +use crate::parse::token::{Token, BinOpToken}; +use crate::symbol::keywords; +use crate::ast::{self, BinOpKind}; /// Associative operator with precedence. /// @@ -72,7 +72,7 @@ pub enum Fixity { impl AssocOp { /// Create a new AssocOP from a token pub fn from_token(t: &Token) -> Option<AssocOp> { - use self::AssocOp::*; + use AssocOp::*; match *t { Token::BinOpEq(k) => Some(AssignOp(k)), Token::LArrow => Some(ObsoleteInPlace), @@ -107,7 +107,7 @@ impl AssocOp { /// Create a new AssocOp from ast::BinOpKind. pub fn from_ast_binop(op: BinOpKind) -> Self { - use self::AssocOp::*; + use AssocOp::*; match op { BinOpKind::Lt => Less, BinOpKind::Gt => Greater, @@ -132,7 +132,7 @@ impl AssocOp { /// Gets the precedence of this operator pub fn precedence(&self) -> usize { - use self::AssocOp::*; + use AssocOp::*; match *self { As | Colon => 14, Multiply | Divide | Modulus => 13, @@ -152,7 +152,7 @@ impl AssocOp { /// Gets the fixity of this operator pub fn fixity(&self) -> Fixity { - use self::AssocOp::*; + use AssocOp::*; // NOTE: it is a bug to have an operators that has same precedence but different fixities! match *self { ObsoleteInPlace | Assign | AssignOp(_) => Fixity::Right, @@ -164,7 +164,7 @@ impl AssocOp { } pub fn is_comparison(&self) -> bool { - use self::AssocOp::*; + use AssocOp::*; match *self { Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true, ObsoleteInPlace | Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add | @@ -174,7 +174,7 @@ impl AssocOp { } pub fn is_assign_like(&self) -> bool { - use self::AssocOp::*; + use AssocOp::*; match *self { Assign | AssignOp(_) | ObsoleteInPlace => true, Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply | Divide | @@ -184,7 +184,7 @@ impl AssocOp { } pub fn to_ast_binop(&self) -> Option<BinOpKind> { - use self::AssocOp::*; + use AssocOp::*; match *self { Less => Some(BinOpKind::Lt), Greater => Some(BinOpKind::Gt), diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index d0b3cd865ce..dbe2b8d39f2 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -1,10 +1,11 @@ -use ast::{self, Ident}; -use source_map::FilePathMapping; -use parse::{ParseSess, PResult, source_file_to_stream}; -use parse::{lexer, new_parser_from_source_str}; -use parse::parser::Parser; -use ptr::P; -use tokenstream::TokenStream; +use crate::ast::{self, Ident}; +use crate::source_map::FilePathMapping; +use crate::parse::{ParseSess, PResult, source_file_to_stream}; +use crate::parse::{lexer, new_parser_from_source_str}; +use crate::parse::parser::Parser; +use crate::ptr::P; +use crate::tokenstream::TokenStream; + use std::iter::Peekable; use std::path::PathBuf; |
