From 93f3f5b1552489dbee03020505d896f01fd53852 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Sat, 18 Aug 2018 13:55:43 +0300 Subject: Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc. --- src/libsyntax_ext/format.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libsyntax_ext') diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index b23c2ec3db1..efe9c2cefde 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -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>, /// Map from named arguments to their resolved indices. - names: HashMap, + names: FxHashMap, /// 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, /// Relative slot numbers for count arguments. - count_positions: HashMap, + count_positions: FxHashMap, /// 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, Vec>, HashMap)> { + -> Option<(P, Vec>, FxHashMap)> { let mut args = Vec::>::new(); - let mut names = HashMap::::new(); + let mut names = FxHashMap::::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, args: Vec>, - names: HashMap, + names: FxHashMap, append_newline: bool) -> P { // NOTE: this verbose way of initializing `Vec>` 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) => {{ -- cgit 1.4.1-3-g733a5