diff options
| author | Nathaniel Herman <nherman@college.harvard.edu> | 2014-01-26 11:24:34 -0500 |
|---|---|---|
| committer | Nathaniel Herman <nherman@college.harvard.edu> | 2014-01-30 18:41:57 -0500 |
| commit | d9fadbc04f5bbd520e4ce8665ac128288e9846c0 (patch) | |
| tree | 006966367d42bf95b22afbd73fabbae5d44a52e4 /src/libsyntax | |
| parent | 339603426e65896a06fcebf63f3d751f242ee820 (diff) | |
| download | rust-d9fadbc04f5bbd520e4ce8665ac128288e9846c0.tar.gz rust-d9fadbc04f5bbd520e4ce8665ac128288e9846c0.zip | |
Make mut_last return Option instead of failing on empty vector (and add a test for mut_last)
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/opt_vec.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs index ce3042cb9cd..c575e170bef 100644 --- a/src/libsyntax/opt_vec.rs +++ b/src/libsyntax/opt_vec.rs @@ -62,10 +62,10 @@ impl<T> OptVec<T> { } } - pub fn mut_last<'a>(&'a mut self) -> &'a mut T { + pub fn mut_last<'a>(&'a mut self) -> Option<&'a mut T> { match *self { Vec(ref mut v) => v.mut_last(), - Empty => fail!("mut_last on empty opt_vec") + Empty => None } } |
