Skip to content

Commit bc96fe9

Browse files
committed
get rid of the std::map::Map LinearMap impl
This legacy trait needs to be dropped in order to migrate to core::container::Map, which doesn't require @ and Copy, and will make proper use of borrowed pointers.
1 parent b7ef28c commit bc96fe9

File tree

1 file changed

+0
-116
lines changed

1 file changed

+0
-116
lines changed

src/libstd/map.rs

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use core::ops;
1919
use core::to_str::ToStr;
2020
use core::mutable::Mut;
2121
use core::prelude::*;
22-
use core::hashmap::linear::LinearMap;
2322
use core::to_bytes::IterBytes;
2423
use core::uint;
2524
use core::vec;
@@ -498,121 +497,6 @@ pub fn hash_from_vec<K: Eq IterBytes Hash Const Copy, V: Copy>(
498497
map
499498
}
500499

501-
// FIXME #4431: Transitional
502-
impl<K: Eq IterBytes Hash Copy, V: Copy> @Mut<LinearMap<K, V>>:
503-
Map<K, V> {
504-
pure fn size() -> uint {
505-
unsafe {
506-
do self.borrow_const |p| {
507-
p.len()
508-
}
509-
}
510-
}
511-
512-
fn insert(key: K, value: V) -> bool {
513-
do self.borrow_mut |p| {
514-
p.insert(key, value)
515-
}
516-
}
517-
518-
pure fn contains_key(key: K) -> bool {
519-
do self.borrow_const |p| {
520-
p.contains_key(&key)
521-
}
522-
}
523-
524-
pure fn contains_key_ref(key: &K) -> bool {
525-
do self.borrow_const |p| {
526-
p.contains_key(key)
527-
}
528-
}
529-
530-
pure fn get(key: K) -> V {
531-
do self.borrow_const |p| {
532-
p.get(&key)
533-
}
534-
}
535-
536-
pure fn find(key: K) -> Option<V> {
537-
unsafe {
538-
do self.borrow_const |p| {
539-
p.find(&key)
540-
}
541-
}
542-
}
543-
544-
fn update_with_key(key: K, newval: V, ff: fn(K, V, V) -> V) -> bool {
545-
match self.find(key) {
546-
None => return self.insert(key, newval),
547-
Some(copy orig) => return self.insert(key, ff(key, orig, newval))
548-
}
549-
}
550-
551-
fn update(key: K, newval: V, ff: fn(V, V) -> V) -> bool {
552-
return self.update_with_key(key, newval, |_k, v, v1| ff(v,v1));
553-
}
554-
555-
fn remove(key: K) -> bool {
556-
do self.borrow_mut |p| {
557-
p.remove(&key)
558-
}
559-
}
560-
561-
fn clear() {
562-
do self.borrow_mut |p| {
563-
p.clear()
564-
}
565-
}
566-
567-
pure fn each(op: fn(key: K, value: V) -> bool) {
568-
unsafe {
569-
do self.borrow_imm |p| {
570-
p.each(|k, v| op(*k, *v))
571-
}
572-
}
573-
}
574-
575-
pure fn each_key(op: fn(key: K) -> bool) {
576-
unsafe {
577-
do self.borrow_imm |p| {
578-
p.each_key(|k| op(*k))
579-
}
580-
}
581-
}
582-
583-
pure fn each_value(op: fn(value: V) -> bool) {
584-
unsafe {
585-
do self.borrow_imm |p| {
586-
p.each_value(|v| op(*v))
587-
}
588-
}
589-
}
590-
591-
pure fn each_ref(op: fn(key: &K, value: &V) -> bool) {
592-
unsafe {
593-
do self.borrow_imm |p| {
594-
p.each(op)
595-
}
596-
}
597-
}
598-
599-
pure fn each_key_ref(op: fn(key: &K) -> bool) {
600-
unsafe {
601-
do self.borrow_imm |p| {
602-
p.each_key(op)
603-
}
604-
}
605-
}
606-
607-
pure fn each_value_ref(op: fn(value: &V) -> bool) {
608-
unsafe {
609-
do self.borrow_imm |p| {
610-
p.each_value(op)
611-
}
612-
}
613-
}
614-
}
615-
616500
#[cfg(test)]
617501
mod tests {
618502
use map;

0 commit comments

Comments
 (0)