Skip to content

Commit 736155e

Browse files
committed
libstd: Change HashMap::new and HashSet::new to HashMap::init and
`HashSet::init` respectively
1 parent cf3f0bd commit 736155e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+275
-275
lines changed

src/libextra/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ pub fn write_boxplot(w: &mut io::Writer, s: &Summary, width_hint: uint) {
372372
/// Returns a HashMap with the number of occurrences of every element in the
373373
/// sequence that the iterator exposes.
374374
pub fn freq_count<T: Iterator<U>, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap<U, uint> {
375-
let mut map: hashmap::HashMap<U,uint> = hashmap::HashMap::new();
375+
let mut map: hashmap::HashMap<U,uint> = hashmap::HashMap::init();
376376
for elem in iter {
377377
map.insert_or_update_with(elem, 1, |_, count| *count += 1);
378378
}

src/libextra/terminfo/parser/compiled.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ pub fn parse(file: &mut io::Reader,
222222

223223
debug!("term names: {:?}", term_names);
224224

225-
let mut bools_map = HashMap::new();
225+
let mut bools_map = HashMap::init();
226226
if bools_bytes != 0 {
227227
for i in range(0, bools_bytes) {
228228
let b = file.read_byte().unwrap();
@@ -243,7 +243,7 @@ pub fn parse(file: &mut io::Reader,
243243
file.read_byte(); // compensate for padding
244244
}
245245

246-
let mut numbers_map = HashMap::new();
246+
let mut numbers_map = HashMap::init();
247247
if numbers_count != 0 {
248248
for i in range(0, numbers_count) {
249249
let n = file.read_le_u16();
@@ -256,7 +256,7 @@ pub fn parse(file: &mut io::Reader,
256256

257257
debug!("numbers: {:?}", numbers_map);
258258

259-
let mut string_map = HashMap::new();
259+
let mut string_map = HashMap::init();
260260

261261
if string_offsets_count != 0 {
262262
let mut string_offsets = vec::with_capacity(10);

src/libextra/url.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ pub fn encode_form_urlencoded(m: &HashMap<~str, ~[~str]>) -> ~str {
245245
*/
246246
pub fn decode_form_urlencoded(s: &[u8]) -> HashMap<~str, ~[~str]> {
247247
let mut rdr = BufReader::new(s);
248-
let mut m = HashMap::new();
248+
let mut m = HashMap::init();
249249
let mut key = ~"";
250250
let mut value = ~"";
251251
let mut parsing_key = true;
@@ -1086,18 +1086,18 @@ mod tests {
10861086
10871087
#[test]
10881088
fn test_encode_form_urlencoded() {
1089-
let mut m = HashMap::new();
1089+
let mut m = HashMap::init();
10901090
assert_eq!(encode_form_urlencoded(&m), ~"");
10911091
10921092
m.insert(~"", ~[]);
10931093
m.insert(~"foo", ~[]);
10941094
assert_eq!(encode_form_urlencoded(&m), ~"");
10951095
1096-
let mut m = HashMap::new();
1096+
let mut m = HashMap::init();
10971097
m.insert(~"foo", ~[~"bar", ~"123"]);
10981098
assert_eq!(encode_form_urlencoded(&m), ~"foo=bar&foo=123");
10991099
1100-
let mut m = HashMap::new();
1100+
let mut m = HashMap::init();
11011101
m.insert(~"foo bar", ~[~"abc", ~"12 = 34"]);
11021102
assert!(encode_form_urlencoded(&m) ==
11031103
~"foo+bar=abc&foo+bar=12+%3D+34");

src/librustc/back/rpath.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> ~str {
156156
}
157157

158158
pub fn minimize_rpaths(rpaths: &[~str]) -> ~[~str] {
159-
let mut set = HashSet::new();
159+
let mut set = HashSet::init();
160160
let mut minimized = ~[];
161161
for rpath in rpaths.iter() {
162162
if set.insert(rpath.as_slice()) {

src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ pub fn build_session_(sopts: @session::options,
843843
filesearch: filesearch,
844844
building_library: @mut false,
845845
working_dir: os::getcwd(),
846-
lints: @mut HashMap::new(),
846+
lints: @mut HashMap::init(),
847847
node_id: @mut 1
848848
}
849849
}

src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pub fn basic_options() -> @options {
368368
save_temps: false,
369369
jit: false,
370370
output_type: link::output_type_exe,
371-
addl_lib_search_paths: @mut HashSet::new(),
371+
addl_lib_search_paths: @mut HashSet::init(),
372372
linker: None,
373373
linker_args: ~[],
374374
maybe_sysroot: None,

src/librustc/lib/llvm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,8 +1775,8 @@ pub struct TypeNames {
17751775
impl TypeNames {
17761776
pub fn new() -> TypeNames {
17771777
TypeNames {
1778-
type_names: HashMap::new(),
1779-
named_types: HashMap::new()
1778+
type_names: HashMap::init(),
1779+
named_types: HashMap::init()
17801780
}
17811781
}
17821782

src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map {
324324
debug!("resolving deps of external crate");
325325
// The map from crate numbers in the crate we're resolving to local crate
326326
// numbers
327-
let mut cnum_map = HashMap::new();
327+
let mut cnum_map = HashMap::init();
328328
let r = decoder::get_crate_deps(cdata);
329329
for dep in r.iter() {
330330
let extrn_cnum = dep.cnum;

src/librustc/metadata/cstore.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ type extern_mod_crate_map = HashMap<ast::NodeId, ast::CrateNum>;
4848

4949
pub fn mk_cstore(intr: @ident_interner) -> CStore {
5050
return CStore {
51-
metas: HashMap::new(),
52-
extern_mod_crate_map: HashMap::new(),
51+
metas: HashMap::init(),
52+
extern_mod_crate_map: HashMap::init(),
5353
used_crate_files: ~[],
5454
used_libraries: ~[],
5555
used_link_args: ~[],

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ pub fn encode_metadata(parms: EncodeParams, crate: &Crate) -> ~[u8] {
17711771
non_inlineable_statics,
17721772
_
17731773
} = parms;
1774-
let type_abbrevs = @mut HashMap::new();
1774+
let type_abbrevs = @mut HashMap::init();
17751775
let stats = @mut stats;
17761776
let ecx = EncodeContext {
17771777
diag: diag,

0 commit comments

Comments
 (0)