oops, fix option.expect() and use it in libstd/map.rs

This commit is contained in:
Ben Blum 2012-07-03 21:03:39 -04:00
parent a76ed88f54
commit aa909dc60a
2 changed files with 3 additions and 3 deletions

View File

@ -136,7 +136,7 @@ impl extensions<T: copy> for option<T> {
Fails if the value equals `none` Fails if the value equals `none`
"] "]
pure fn expect<T: copy>(reason: str) -> T { expect(self, reason) } pure fn expect(reason: str) -> T { expect(self, reason) }
} }
#[test] #[test]

View File

@ -232,11 +232,11 @@ mod chained {
} }
fn get(k: K) -> V { fn get(k: K) -> V {
option::get(self.find(k)) self.find(k).expect("Key not found in table")
} }
fn [](k: K) -> V { fn [](k: K) -> V {
option::get(self.find(k)) self.get(k)
} }
fn remove(k: K) -> option<V> { fn remove(k: K) -> option<V> {