From 4fd9264875c0e0ee450316e8fbf15977d8978a74 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 3 Feb 2013 17:12:33 -0500 Subject: [PATCH] oldmap: &K instead of K for the remove parameter --- src/libcargo/cargo.rc | 6 +++--- src/librustc/middle/trans/_match.rs | 2 +- src/librustc/middle/typeck/infer/region_inference.rs | 4 ++-- src/libstd/oldmap.rs | 6 +++--- src/test/bench/core-map.rs | 4 ++-- src/test/bench/shootout-mandelbrot.rs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libcargo/cargo.rc b/src/libcargo/cargo.rc index d0783911f72..960bcf88eb7 100644 --- a/src/libcargo/cargo.rc +++ b/src/libcargo/cargo.rc @@ -1687,7 +1687,7 @@ pub fn cmd_sources(c: &Cargo) { match action { ~"clear" => { for c.sources.each_key_ref |&k| { - c.sources.remove(k); + c.sources.remove(&k); } info(~"cleared sources"); @@ -1734,7 +1734,7 @@ pub fn cmd_sources(c: &Cargo) { } if c.sources.contains_key_ref(&name) { - c.sources.remove(name); + c.sources.remove(&name); info(fmt!("removed source: %s", name)); } else { error(fmt!("no such source: %s", name)); @@ -1825,7 +1825,7 @@ pub fn cmd_sources(c: &Cargo) { match c.sources.find(name) { Some(source) => { - c.sources.remove(name); + c.sources.remove(&name); c.sources.insert(newn, source); info(fmt!("renamed source: %s to %s", name, newn)); } diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 3b168b1d5f7..6913cf8e2f5 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -1198,7 +1198,7 @@ pub fn compile_guard(bcx: block, } TrByRef | TrByImplicitRef => {} } - bcx.fcx.lllocals.remove(binding_info.id); + bcx.fcx.lllocals.remove(&binding_info.id); } return bcx; } diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index 0d20b87ccd9..1a8e25239b3 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -712,11 +712,11 @@ pub impl RegionVarBindings { assert self.var_spans.len() == *vid + 1; self.var_spans.pop(); } - AddConstraint(constraint) => { + AddConstraint(ref constraint) => { self.constraints.remove(constraint); } AddCombination(map, ref regions) => { - map.remove((*regions)); + map.remove(regions); } } } diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs index adfc8854443..8e76cc6a7d2 100644 --- a/src/libstd/oldmap.rs +++ b/src/libstd/oldmap.rs @@ -299,8 +299,8 @@ pub mod chained { option::unwrap(move opt_v) } - fn remove(k: K) -> bool { - match self.search_tbl(&k, k.hash_keyed(0,0) as uint) { + fn remove(k: &K) -> bool { + match self.search_tbl(k, k.hash_keyed(0,0) as uint) { NotFound => false, FoundFirst(idx, entry) => { self.count -= 1u; @@ -578,7 +578,7 @@ mod tests { debug!("removing evens"); i = 0u; while i < num_to_insert { - let v = hm.remove(i); + let v = hm.remove(&i); assert v; i += 2u; } diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index baf78c5112b..ecb228e401d 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -64,7 +64,7 @@ fn old_int_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) { do timed(&mut results.delete_ints) { for uint::range(0, num_keys) |i| { - assert map.remove(i); + assert map.remove(&i); } } } @@ -103,7 +103,7 @@ fn old_str_benchmarks(rng: @rand::Rng, num_keys: uint, results: &mut Results) { } do timed(&mut results.delete_strings) { for uint::range(0, num_keys) |i| { - assert map.remove(uint::to_str(i, 10)); + assert map.remove(&uint::to_str(i, 10)); } } } diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index bedea9600b6..8cf57b19825 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -138,7 +138,7 @@ fn writer(path: ~str, pport: pipes::Port, size: uint) debug!("WS %u", prev); cout.write(lines.get(prev)); done += 1_u; - lines.remove(prev); + lines.remove(&prev); prev += 1_u; } else {