Skip to content

Commit 2e49681

Browse files
committed
oldmap: get rid of the legacy each_key method
1 parent 88d9d41 commit 2e49681

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

src/libcargo/cargo.rc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ pub fn configure(opts: Options) -> Cargo {
730730
need_dir(&c.libdir);
731731
need_dir(&c.bindir);
732732

733-
for sources.each_key |k| {
733+
for sources.each_key_ref |&k| {
734734
let mut s = sources.get(k);
735735
load_source_packages(&c, s);
736736
sources.insert(k, s);
@@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &Cargo) {
11551155
}
11561156

11571157
pub fn sync(c: &Cargo) {
1158-
for c.sources.each_key |k| {
1158+
for c.sources.each_key_ref |&k| {
11591159
let mut s = c.sources.get(k);
11601160
sync_one(c, s);
11611161
c.sources.insert(k, s);
@@ -1686,7 +1686,7 @@ pub fn cmd_sources(c: &Cargo) {
16861686

16871687
match action {
16881688
~"clear" => {
1689-
for c.sources.each_key |k| {
1689+
for c.sources.each_key_ref |&k| {
16901690
c.sources.remove(k);
16911691
}
16921692

src/librustc/middle/typeck/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ pub impl CoherenceChecker {
417417
let coherence_info = &self.crate_context.coherence_info;
418418
let extension_methods = &coherence_info.extension_methods;
419419

420-
for extension_methods.each_key |trait_id| {
420+
for extension_methods.each_key_ref |&trait_id| {
421421
self.check_implementation_coherence_of(trait_id);
422422
}
423423
}

src/librustc/rustc.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Available lint options:
177177

178178
let lint_dict = lint::get_lint_dict();
179179
let mut max_key = 0;
180-
for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); }
180+
for lint_dict.each_key_ref |&k| { max_key = uint::max(k.len(), max_key); }
181181
fn padded(max: uint, s: &str) -> ~str {
182182
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
183183
}

src/libstd/oldmap.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,6 @@ pub mod chained {
320320
self.each_ref(|k, v| blk(*k, *v))
321321
}
322322

323-
pure fn each_key(blk: fn(key: K) -> bool) {
324-
self.each_key_ref(|p| blk(*p))
325-
}
326-
327323
pure fn each_ref(blk: fn(key: &K, value: &V) -> bool) {
328324
for self.each_entry |entry| {
329325
if !blk(&entry.key, &entry.value) { break; }
@@ -407,7 +403,7 @@ pub fn set_add<K:Eq IterBytes Hash Const Copy>(set: Set<K>, key: K) -> bool {
407403
/// Convert a set into a vector.
408404
pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
409405
do vec::build_sized(s.len()) |push| {
410-
for s.each_key() |k| {
406+
for s.each_key_ref() |&k| {
411407
push(k);
412408
}
413409
}

src/libsyntax/parse/token.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,13 +454,13 @@ pub fn mk_fake_ident_interner() -> @ident_interner {
454454
*/
455455
pub fn keyword_table() -> HashMap<~str, ()> {
456456
let keywords = HashMap();
457-
for temporary_keyword_table().each_key |word| {
457+
for temporary_keyword_table().each_key_ref |&word| {
458458
keywords.insert(word, ());
459459
}
460-
for strict_keyword_table().each_key |word| {
460+
for strict_keyword_table().each_key_ref |&word| {
461461
keywords.insert(word, ());
462462
}
463-
for reserved_keyword_table().each_key |word| {
463+
for reserved_keyword_table().each_key_ref |&word| {
464464
keywords.insert(word, ());
465465
}
466466
keywords

0 commit comments

Comments
 (0)