diff options
| author | Paul Stansifer <paul.stansifer@gmail.com> | 2012-08-22 17:24:52 -0700 |
|---|---|---|
| committer | Paul Stansifer <paul.stansifer@gmail.com> | 2012-08-23 11:14:14 -0700 |
| commit | 29f32b4a7298b0807408658bc8add1de8a06ab12 (patch) | |
| tree | c989293754f94ce2c22cee3902af0c57d33e6dd0 /src/libstd/map.rs | |
| parent | 226fd87199fb0184fb39ffc5dff3865cfdc9f362 (diff) | |
| download | rust-29f32b4a7298b0807408658bc8add1de8a06ab12.tar.gz rust-29f32b4a7298b0807408658bc8add1de8a06ab12.zip | |
`m1!{...}` -> `m1!(...)`
Diffstat (limited to 'src/libstd/map.rs')
| -rw-r--r-- | src/libstd/map.rs | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 3056b6b938a..7ed64c947a2 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -137,16 +137,16 @@ mod chained { loop { match copy e0.next { none => { - debug!{"search_tbl: absent, comp %u, hash %u, idx %u", - comp, h, idx}; + debug!("search_tbl: absent, comp %u, hash %u, idx %u", + comp, h, idx); return not_found; } some(e1) => { comp += 1u; if e1.hash == h && self.eqer(&e1.key, k) { - debug!{"search_tbl: present, comp %u, \ + debug!("search_tbl: present, comp %u, \ hash %u, idx %u", - comp, h, idx}; + comp, h, idx); return found_after(e0, e1); } else { e0 = e1; @@ -160,14 +160,14 @@ mod chained { let idx = h % vec::len(self.chains); match copy self.chains[idx] { none => { - debug!{"search_tbl: none, comp %u, hash %u, idx %u", - 0u, h, idx}; + debug!("search_tbl: none, comp %u, hash %u, idx %u", + 0u, h, idx); return not_found; } some(e) => { if e.hash == h && self.eqer(&e.key, k) { - debug!{"search_tbl: present, comp %u, hash %u, idx %u", - 1u, h, idx}; + debug!("search_tbl: present, comp %u, hash %u, idx %u", + 1u, h, idx); return found_first(idx, e); } else { return self.search_rem(k, h, idx, e); @@ -277,7 +277,7 @@ mod chained { fn get(+k: K) -> V { let opt_v = self.find(k); if opt_v.is_none() { - fail fmt!{"Key not found in table: %?", k}; + fail fmt!("Key not found in table: %?", k); } option::unwrap(opt_v) } @@ -563,14 +563,14 @@ mod tests { #[test] fn test_simple() { - debug!{"*** starting test_simple"}; + debug!("*** starting test_simple"); pure fn eq_uint(x: &uint, y: &uint) -> bool { *x == *y } pure fn uint_id(x: &uint) -> uint { *x } let hasher_uint: map::hashfn<uint> = uint_id; let eqer_uint: map::eqfn<uint> = eq_uint; let hasher_str: map::hashfn<~str> = str::hash; let eqer_str: map::eqfn<~str> = str::eq; - debug!{"uint -> uint"}; + debug!("uint -> uint"); let hm_uu: map::hashmap<uint, uint> = map::hashmap::<uint, uint>(copy hasher_uint, copy eqer_uint); assert (hm_uu.insert(10u, 12u)); @@ -586,7 +586,7 @@ mod tests { let ten: ~str = ~"ten"; let eleven: ~str = ~"eleven"; let twelve: ~str = ~"twelve"; - debug!{"str -> uint"}; + debug!("str -> uint"); let hm_su: map::hashmap<~str, uint> = map::hashmap::<~str, uint>(copy hasher_str, copy eqer_str); assert (hm_su.insert(~"ten", 12u)); @@ -600,7 +600,7 @@ mod tests { assert (hm_su.get(~"twelve") == 14u); assert (!hm_su.insert(~"twelve", 12u)); assert (hm_su.get(~"twelve") == 12u); - debug!{"uint -> str"}; + debug!("uint -> str"); let hm_us: map::hashmap<uint, ~str> = map::hashmap::<uint, ~str>(copy hasher_uint, copy eqer_uint); assert (hm_us.insert(10u, ~"twelve")); @@ -613,7 +613,7 @@ mod tests { assert hm_us.get(12u) == ~"fourteen"; assert (!hm_us.insert(12u, ~"twelve")); assert hm_us.get(12u) == ~"twelve"; - debug!{"str -> str"}; + debug!("str -> str"); let hm_ss: map::hashmap<~str, ~str> = map::hashmap::<~str, ~str>(copy hasher_str, copy eqer_str); assert (hm_ss.insert(ten, ~"twelve")); @@ -626,7 +626,7 @@ mod tests { assert hm_ss.get(~"twelve") == ~"fourteen"; assert (!hm_ss.insert(~"twelve", ~"twelve")); assert hm_ss.get(~"twelve") == ~"twelve"; - debug!{"*** finished test_simple"}; + debug!("*** finished test_simple"); } @@ -635,11 +635,11 @@ mod tests { */ #[test] fn test_growth() { - debug!{"*** starting test_growth"}; + debug!("*** starting test_growth"); let num_to_insert: uint = 64u; pure fn eq_uint(x: &uint, y: &uint) -> bool { *x == *y } pure fn uint_id(x: &uint) -> uint { *x } - debug!{"uint -> uint"}; + debug!("uint -> uint"); let hasher_uint: map::hashfn<uint> = uint_id; let eqer_uint: map::eqfn<uint> = eq_uint; let hm_uu: map::hashmap<uint, uint> = @@ -647,26 +647,26 @@ mod tests { let mut i: uint = 0u; while i < num_to_insert { assert (hm_uu.insert(i, i * i)); - debug!{"inserting %u -> %u", i, i*i}; + debug!("inserting %u -> %u", i, i*i); i += 1u; } - debug!{"-----"}; + debug!("-----"); i = 0u; while i < num_to_insert { - debug!{"get(%u) = %u", i, hm_uu.get(i)}; + debug!("get(%u) = %u", i, hm_uu.get(i)); assert (hm_uu.get(i) == i * i); i += 1u; } assert (hm_uu.insert(num_to_insert, 17u)); assert (hm_uu.get(num_to_insert) == 17u); - debug!{"-----"}; + debug!("-----"); i = 0u; while i < num_to_insert { - debug!{"get(%u) = %u", i, hm_uu.get(i)}; + debug!("get(%u) = %u", i, hm_uu.get(i)); assert (hm_uu.get(i) == i * i); i += 1u; } - debug!{"str -> str"}; + debug!("str -> str"); let hasher_str: map::hashfn<~str> = str::hash; let eqer_str: map::eqfn<~str> = str::eq; let hm_ss: map::hashmap<~str, ~str> = @@ -674,17 +674,17 @@ mod tests { i = 0u; while i < num_to_insert { assert hm_ss.insert(uint::to_str(i, 2u), uint::to_str(i * i, 2u)); - debug!{"inserting \"%s\" -> \"%s\"", + debug!("inserting \"%s\" -> \"%s\"", uint::to_str(i, 2u), - uint::to_str(i*i, 2u)}; + uint::to_str(i*i, 2u)); i += 1u; } - debug!{"-----"}; + debug!("-----"); i = 0u; while i < num_to_insert { - debug!{"get(\"%s\") = \"%s\"", + debug!("get(\"%s\") = \"%s\"", uint::to_str(i, 2u), - hm_ss.get(uint::to_str(i, 2u))}; + hm_ss.get(uint::to_str(i, 2u))); assert hm_ss.get(uint::to_str(i, 2u)) == uint::to_str(i * i, 2u); i += 1u; } @@ -692,21 +692,21 @@ mod tests { uint::to_str(17u, 2u))); assert hm_ss.get(uint::to_str(num_to_insert, 2u)) == uint::to_str(17u, 2u); - debug!{"-----"}; + debug!("-----"); i = 0u; while i < num_to_insert { - debug!{"get(\"%s\") = \"%s\"", + debug!("get(\"%s\") = \"%s\"", uint::to_str(i, 2u), - hm_ss.get(uint::to_str(i, 2u))}; + hm_ss.get(uint::to_str(i, 2u))); assert hm_ss.get(uint::to_str(i, 2u)) == uint::to_str(i * i, 2u); i += 1u; } - debug!{"*** finished test_growth"}; + debug!("*** finished test_growth"); } #[test] fn test_removal() { - debug!{"*** starting test_removal"}; + debug!("*** starting test_removal"); let num_to_insert: uint = 64u; fn eq(x: &uint, y: &uint) -> bool { *x == *y } fn hash(u: &uint) -> uint { @@ -724,12 +724,12 @@ mod tests { let mut i: uint = 0u; while i < num_to_insert { assert (hm.insert(i, i * i)); - debug!{"inserting %u -> %u", i, i*i}; + debug!("inserting %u -> %u", i, i*i); i += 1u; } assert (hm.size() == num_to_insert); - debug!{"-----"}; - debug!{"removing evens"}; + debug!("-----"); + debug!("removing evens"); i = 0u; while i < num_to_insert { let v = hm.remove(i); @@ -737,44 +737,44 @@ mod tests { i += 2u; } assert (hm.size() == num_to_insert / 2u); - debug!{"-----"}; + debug!("-----"); i = 1u; while i < num_to_insert { - debug!{"get(%u) = %u", i, hm.get(i)}; + debug!("get(%u) = %u", i, hm.get(i)); assert (hm.get(i) == i * i); i += 2u; } - debug!{"-----"}; + debug!("-----"); i = 1u; while i < num_to_insert { - debug!{"get(%u) = %u", i, hm.get(i)}; + debug!("get(%u) = %u", i, hm.get(i)); assert (hm.get(i) == i * i); i += 2u; } - debug!{"-----"}; + debug!("-----"); i = 0u; while i < num_to_insert { assert (hm.insert(i, i * i)); - debug!{"inserting %u -> %u", i, i*i}; + debug!("inserting %u -> %u", i, i*i); i += 2u; } assert (hm.size() == num_to_insert); - debug!{"-----"}; + debug!("-----"); i = 0u; while i < num_to_insert { - debug!{"get(%u) = %u", i, hm.get(i)}; + debug!("get(%u) = %u", i, hm.get(i)); assert (hm.get(i) == i * i); i += 1u; } - debug!{"-----"}; + debug!("-----"); assert (hm.size() == num_to_insert); i = 0u; while i < num_to_insert { - debug!{"get(%u) = %u", i, hm.get(i)}; + debug!("get(%u) = %u", i, hm.get(i)); assert (hm.get(i) == i * i); i += 1u; } - debug!{"*** finished test_removal"}; + debug!("*** finished test_removal"); } #[test] |
