]> git.lizzy.rs Git - rust.git/commitdiff
[std::vec] Rename .get_opt() to .get()
authorSimon Sapin <simon.sapin@exyr.org>
Mon, 23 Dec 2013 13:38:02 +0000 (14:38 +0100)
committerSimon Sapin <simon.sapin@exyr.org>
Tue, 21 Jan 2014 19:44:13 +0000 (11:44 -0800)
src/libstd/vec.rs

index d85e679c6a36140602df45795a4a75cecdf521ce..baeda1d7ae50265fe71d3dd8cd10c09f276b2db0 100644 (file)
@@ -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 @@ fn chunks(self, size: uint) -> Chunks<'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 @@ fn test_len_divzero() {
     }
 
     #[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]