oldmap: get rid of the legacy each_key method
This commit is contained in:
parent
88d9d417a1
commit
2e496818a5
5 changed files with 9 additions and 13 deletions
|
@ -730,7 +730,7 @@ pub fn configure(opts: Options) -> Cargo {
|
||||||
need_dir(&c.libdir);
|
need_dir(&c.libdir);
|
||||||
need_dir(&c.bindir);
|
need_dir(&c.bindir);
|
||||||
|
|
||||||
for sources.each_key |k| {
|
for sources.each_key_ref |&k| {
|
||||||
let mut s = sources.get(k);
|
let mut s = sources.get(k);
|
||||||
load_source_packages(&c, s);
|
load_source_packages(&c, s);
|
||||||
sources.insert(k, s);
|
sources.insert(k, s);
|
||||||
|
@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &Cargo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sync(c: &Cargo) {
|
pub fn sync(c: &Cargo) {
|
||||||
for c.sources.each_key |k| {
|
for c.sources.each_key_ref |&k| {
|
||||||
let mut s = c.sources.get(k);
|
let mut s = c.sources.get(k);
|
||||||
sync_one(c, s);
|
sync_one(c, s);
|
||||||
c.sources.insert(k, s);
|
c.sources.insert(k, s);
|
||||||
|
@ -1686,7 +1686,7 @@ pub fn cmd_sources(c: &Cargo) {
|
||||||
|
|
||||||
match action {
|
match action {
|
||||||
~"clear" => {
|
~"clear" => {
|
||||||
for c.sources.each_key |k| {
|
for c.sources.each_key_ref |&k| {
|
||||||
c.sources.remove(k);
|
c.sources.remove(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,7 @@ pub impl CoherenceChecker {
|
||||||
let coherence_info = &self.crate_context.coherence_info;
|
let coherence_info = &self.crate_context.coherence_info;
|
||||||
let extension_methods = &coherence_info.extension_methods;
|
let extension_methods = &coherence_info.extension_methods;
|
||||||
|
|
||||||
for extension_methods.each_key |trait_id| {
|
for extension_methods.each_key_ref |&trait_id| {
|
||||||
self.check_implementation_coherence_of(trait_id);
|
self.check_implementation_coherence_of(trait_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ Available lint options:
|
||||||
|
|
||||||
let lint_dict = lint::get_lint_dict();
|
let lint_dict = lint::get_lint_dict();
|
||||||
let mut max_key = 0;
|
let mut max_key = 0;
|
||||||
for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); }
|
for lint_dict.each_key_ref |&k| { max_key = uint::max(k.len(), max_key); }
|
||||||
fn padded(max: uint, s: &str) -> ~str {
|
fn padded(max: uint, s: &str) -> ~str {
|
||||||
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
|
str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,10 +320,6 @@ pub mod chained {
|
||||||
self.each_ref(|k, v| blk(*k, *v))
|
self.each_ref(|k, v| blk(*k, *v))
|
||||||
}
|
}
|
||||||
|
|
||||||
pure fn each_key(blk: fn(key: K) -> bool) {
|
|
||||||
self.each_key_ref(|p| blk(*p))
|
|
||||||
}
|
|
||||||
|
|
||||||
pure fn each_ref(blk: fn(key: &K, value: &V) -> bool) {
|
pure fn each_ref(blk: fn(key: &K, value: &V) -> bool) {
|
||||||
for self.each_entry |entry| {
|
for self.each_entry |entry| {
|
||||||
if !blk(&entry.key, &entry.value) { break; }
|
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 {
|
||||||
/// Convert a set into a vector.
|
/// Convert a set into a vector.
|
||||||
pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
|
pub pure fn vec_from_set<T:Eq IterBytes Hash Copy>(s: Set<T>) -> ~[T] {
|
||||||
do vec::build_sized(s.len()) |push| {
|
do vec::build_sized(s.len()) |push| {
|
||||||
for s.each_key() |k| {
|
for s.each_key_ref() |&k| {
|
||||||
push(k);
|
push(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,13 +454,13 @@ pub fn mk_fake_ident_interner() -> @ident_interner {
|
||||||
*/
|
*/
|
||||||
pub fn keyword_table() -> HashMap<~str, ()> {
|
pub fn keyword_table() -> HashMap<~str, ()> {
|
||||||
let keywords = HashMap();
|
let keywords = HashMap();
|
||||||
for temporary_keyword_table().each_key |word| {
|
for temporary_keyword_table().each_key_ref |&word| {
|
||||||
keywords.insert(word, ());
|
keywords.insert(word, ());
|
||||||
}
|
}
|
||||||
for strict_keyword_table().each_key |word| {
|
for strict_keyword_table().each_key_ref |&word| {
|
||||||
keywords.insert(word, ());
|
keywords.insert(word, ());
|
||||||
}
|
}
|
||||||
for reserved_keyword_table().each_key |word| {
|
for reserved_keyword_table().each_key_ref |&word| {
|
||||||
keywords.insert(word, ());
|
keywords.insert(word, ());
|
||||||
}
|
}
|
||||||
keywords
|
keywords
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue