Revert "oldmap: use &K instead of K in find and get"

This reverts commit 8e643525d4.
This commit is contained in:
Graydon Hoare 2013-02-05 14:30:53 -08:00
parent 0110dfb27c
commit a4250a96fd
78 changed files with 479 additions and 482 deletions

View file

@ -20,5 +20,5 @@ pub type header_map = HashMap<~str, @DVec<@~str>>;
// the unused ty param is necessary so this gets monomorphized
pub fn request<T: Copy>(req: header_map) {
let _x = copy *(copy *req.get(&~"METHOD"))[0u];
let _x = copy *(copy *req.get(~"METHOD"))[0u];
}

View file

@ -42,7 +42,7 @@ fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
}
for uint::range(0, num_keys) |i| {
assert map.get(&i) == i+1;
assert map.get(i) == i+1;
}
}
}
@ -81,7 +81,7 @@ fn old_str_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) {
for uint::range(0, num_keys) |i| {
let s = uint::to_str(i);
assert map.get(&s) == i;
assert map.get(s) == i;
}
}
}

View file

@ -83,7 +83,7 @@ fn str_set() {
let mut found = 0;
for int::range(0, 1000) |_i| {
match s.find(&r.gen_str(10)) {
match s.find(r.gen_str(10)) {
Some(_) => { found += 1; }
None => { }
}

View file

@ -69,7 +69,7 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
// given a map, search for the frequency of a pattern
fn find(mm: HashMap<~[u8], uint>, key: ~str) -> uint {
match mm.find(&str::to_bytes(str::to_lower(key))) {
match mm.find(str::to_bytes(str::to_lower(key))) {
option::None => { return 0u; }
option::Some(num) => { return num; }
}

View file

@ -136,7 +136,7 @@ fn writer(path: ~str, pport: pipes::Port<Line>, size: uint)
while prev <= i {
if lines.contains_key_ref(&prev) {
debug!("WS %u", prev);
cout.write(lines.get(&prev));
cout.write(lines.get(prev));
done += 1_u;
lines.remove(&prev);
prev += 1_u;

View file

@ -49,7 +49,7 @@ mod map_reduce {
fn emit(im: oldmap::HashMap<~str, int>, ctrl: SharedChan<ctrl_proto>, key: ~str,
val: ~str) {
let mut c;
match im.find(&key) {
match im.find(copy key) {
Some(_c) => { c = _c }
None => {
let (pp, cc) = stream();
@ -88,7 +88,7 @@ mod map_reduce {
mapper_done => { num_mappers -= 1; }
find_reducer(k, cc) => {
let mut c;
match reducers.find(&str::from_bytes(k)) {
match reducers.find(str::from_bytes(k)) {
Some(_c) => { c = _c; }
None => { c = 0; }
}