diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2013-12-23 14:38:02 +0100 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2014-01-21 11:44:13 -0800 |
| commit | d25334d63a206dc9f7465119be983929782a124a (patch) | |
| tree | e6d19cece5ffaf32f52196319871945b19a00b98 /src/libstd | |
| parent | 232d8e560561e07b3ba54c5d0234816e50342fb3 (diff) | |
| download | rust-d25334d63a206dc9f7465119be983929782a124a.tar.gz rust-d25334d63a206dc9f7465119be983929782a124a.zip | |
[std::vec] Rename .get_opt() to .get()
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/vec.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index d85e679c6a3..baeda1d7ae5 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -941,7 +941,7 @@ pub trait ImmutableVector<'a, T> { /// Returns the element of a vector at the given index, or `None` if the /// index is out of bounds - fn get_opt(&self, index: uint) -> Option<&'a T>; + fn get(&self, index: uint) -> Option<&'a T>; /// Returns the first element of a vector, failing if the vector is empty. fn head(&self) -> &'a T; /// Returns the first element of a vector, or `None` if it is empty @@ -1118,7 +1118,7 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] { } #[inline] - fn get_opt(&self, index: uint) -> Option<&'a T> { + fn get(&self, index: uint) -> Option<&'a T> { if index < self.len() { Some(&self[index]) } else { None } } @@ -3043,13 +3043,13 @@ mod tests { } #[test] - fn test_get_opt() { + fn test_get() { let mut a = ~[11]; - assert_eq!(a.get_opt(1), None); + assert_eq!(a.get(1), None); a = ~[11, 12]; - assert_eq!(a.get_opt(1).unwrap(), &12); + assert_eq!(a.get(1).unwrap(), &12); a = ~[11, 12, 13]; - assert_eq!(a.get_opt(1).unwrap(), &12); + assert_eq!(a.get(1).unwrap(), &12); } #[test] |
