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/libsyntax/ext/base.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/libsyntax/ext/base.rs')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 1dda2493da2..6ed5ca3e402 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -538,20 +538,20 @@ mod test { m.insert (@"def",@16); // FIXME: #4492 (ICE) assert_eq!(m.find(&@"abc"),Some(@15)); // .... assert_eq!(m.find(&@"def"),Some(@16)); - assert_eq!(*(m.find(&@"abc").get()),15); - assert_eq!(*(m.find(&@"def").get()),16); + assert_eq!(*(m.find(&@"abc").unwrap()),15); + assert_eq!(*(m.find(&@"def").unwrap()),16); let n = m.push_frame(); // old bindings are still present: - assert_eq!(*(n.find(&@"abc").get()),15); - assert_eq!(*(n.find(&@"def").get()),16); + assert_eq!(*(n.find(&@"abc").unwrap()),15); + assert_eq!(*(n.find(&@"def").unwrap()),16); n.insert (@"def",@17); // n shows the new binding - assert_eq!(*(n.find(&@"abc").get()),15); - assert_eq!(*(n.find(&@"def").get()),17); + assert_eq!(*(n.find(&@"abc").unwrap()),15); + assert_eq!(*(n.find(&@"def").unwrap()),17); // ... but m still has the old ones // FIXME: #4492: assert_eq!(m.find(&@"abc"),Some(@15)); // FIXME: #4492: assert_eq!(m.find(&@"def"),Some(@16)); - assert_eq!(*(m.find(&@"abc").get()),15); - assert_eq!(*(m.find(&@"def").get()),16); + assert_eq!(*(m.find(&@"abc").unwrap()),15); + assert_eq!(*(m.find(&@"def").unwrap()),16); } } |
