Skip to content

Commit aa909dc

Browse files
committed
oops, fix option.expect() and use it in libstd/map.rs
1 parent a76ed88 commit aa909dc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl extensions<T: copy> for option<T> {
136136
137137
Fails if the value equals `none`
138138
"]
139-
pure fn expect<T: copy>(reason: str) -> T { expect(self, reason) }
139+
pure fn expect(reason: str) -> T { expect(self, reason) }
140140
}
141141

142142
#[test]

src/libstd/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ mod chained {
232232
}
233233

234234
fn get(k: K) -> V {
235-
option::get(self.find(k))
235+
self.find(k).expect("Key not found in table")
236236
}
237237

238238
fn [](k: K) -> V {
239-
option::get(self.find(k))
239+
self.get(k)
240240
}
241241

242242
fn remove(k: K) -> option<V> {

0 commit comments

Comments
 (0)