diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-08-04 01:59:24 +0200 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-08-05 22:42:21 +0200 |
| commit | 0ac7a219f043d3b1c8c239089d9dd6e6c9fa830b (patch) | |
| tree | 6dbb028659dbc0931ec23398e529549c84bba0a4 /src/libstd/str.rs | |
| parent | d8b299d179653cbde783f62f70b5531dbaa5c5a6 (diff) | |
| download | rust-0ac7a219f043d3b1c8c239089d9dd6e6c9fa830b.tar.gz rust-0ac7a219f043d3b1c8c239089d9dd6e6c9fa830b.zip | |
Updated std::Option, std::Either and std::Result
- Made naming schemes consistent between Option, Result and Either - Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None) - Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
Diffstat (limited to 'src/libstd/str.rs')
| -rw-r--r-- | src/libstd/str.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 1a913fb4e99..95a411a3f96 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -58,7 +58,7 @@ pub fn from_bytes(vv: &[u8]) -> ~str { use str::not_utf8::cond; if !is_utf8(vv) { - let first_bad_byte = *vv.iter().find_(|&b| !is_utf8([*b])).get(); + let first_bad_byte = *vv.iter().find_(|&b| !is_utf8([*b])).unwrap(); cond.raise(fmt!("from_bytes: input is not UTF-8; first bad byte is %u", first_bad_byte as uint)) } else { @@ -75,7 +75,7 @@ pub fn from_bytes_owned(vv: ~[u8]) -> ~str { use str::not_utf8::cond; if !is_utf8(vv) { - let first_bad_byte = *vv.iter().find_(|&b| !is_utf8([*b])).get(); + let first_bad_byte = *vv.iter().find_(|&b| !is_utf8([*b])).unwrap(); cond.raise(fmt!("from_bytes: input is not UTF-8; first bad byte is %u", first_bad_byte as uint)) } else { |
