Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.
This commit is contained in:
@@ -24,9 +24,9 @@ use syntax::tokenstream;
|
||||
use syntax_pos::{MultiSpan, Span, DUMMY_SP};
|
||||
use errors::Applicability;
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use std::borrow::Cow;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum ArgumentType {
|
||||
@@ -65,7 +65,7 @@ struct Context<'a, 'b: 'a> {
|
||||
/// Unique format specs seen for each argument.
|
||||
arg_unique_types: Vec<Vec<ArgumentType>>,
|
||||
/// Map from named arguments to their resolved indices.
|
||||
names: HashMap<String, usize>,
|
||||
names: FxHashMap<String, usize>,
|
||||
|
||||
/// The latest consecutive literal strings, or empty if there weren't any.
|
||||
literal: String,
|
||||
@@ -104,7 +104,7 @@ struct Context<'a, 'b: 'a> {
|
||||
/// * `count_args`: `vec![Exact(0), Exact(5), Exact(3)]`
|
||||
count_args: Vec<Position>,
|
||||
/// Relative slot numbers for count arguments.
|
||||
count_positions: HashMap<usize, usize>,
|
||||
count_positions: FxHashMap<usize, usize>,
|
||||
/// Number of count slots assigned.
|
||||
count_positions_count: usize,
|
||||
|
||||
@@ -134,9 +134,9 @@ struct Context<'a, 'b: 'a> {
|
||||
fn parse_args(ecx: &mut ExtCtxt,
|
||||
sp: Span,
|
||||
tts: &[tokenstream::TokenTree])
|
||||
-> Option<(P<ast::Expr>, Vec<P<ast::Expr>>, HashMap<String, usize>)> {
|
||||
-> Option<(P<ast::Expr>, Vec<P<ast::Expr>>, FxHashMap<String, usize>)> {
|
||||
let mut args = Vec::<P<ast::Expr>>::new();
|
||||
let mut names = HashMap::<String, usize>::new();
|
||||
let mut names = FxHashMap::<String, usize>::default();
|
||||
|
||||
let mut p = ecx.new_parser_from_tts(tts);
|
||||
|
||||
@@ -768,7 +768,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
sp: Span,
|
||||
efmt: P<ast::Expr>,
|
||||
args: Vec<P<ast::Expr>>,
|
||||
names: HashMap<String, usize>,
|
||||
names: FxHashMap<String, usize>,
|
||||
append_newline: bool)
|
||||
-> P<ast::Expr> {
|
||||
// NOTE: this verbose way of initializing `Vec<Vec<ArgumentType>>` is because
|
||||
@@ -852,7 +852,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
curpiece: 0,
|
||||
arg_index_map: Vec::new(),
|
||||
count_args: Vec::new(),
|
||||
count_positions: HashMap::new(),
|
||||
count_positions: FxHashMap::default(),
|
||||
count_positions_count: 0,
|
||||
count_args_index_offset: 0,
|
||||
literal: String::new(),
|
||||
@@ -952,7 +952,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||
|
||||
// The set of foreign substitutions we've explained. This prevents spamming the user
|
||||
// with `%d should be written as {}` over and over again.
|
||||
let mut explained = HashSet::new();
|
||||
let mut explained = FxHashSet::default();
|
||||
|
||||
macro_rules! check_foreign {
|
||||
($kind:ident) => {{
|
||||
|
||||
Reference in New Issue
Block a user