Skip to content

Commit d25334d

Browse files
committed
[std::vec] Rename .get_opt() to .get()
1 parent 232d8e5 commit d25334d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libstd/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ pub trait ImmutableVector<'a, T> {
941941

942942
/// Returns the element of a vector at the given index, or `None` if the
943943
/// index is out of bounds
944-
fn get_opt(&self, index: uint) -> Option<&'a T>;
944+
fn get(&self, index: uint) -> Option<&'a T>;
945945
/// Returns the first element of a vector, failing if the vector is empty.
946946
fn head(&self) -> &'a T;
947947
/// 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] {
11181118
}
11191119

11201120
#[inline]
1121-
fn get_opt(&self, index: uint) -> Option<&'a T> {
1121+
fn get(&self, index: uint) -> Option<&'a T> {
11221122
if index < self.len() { Some(&self[index]) } else { None }
11231123
}
11241124

@@ -3043,13 +3043,13 @@ mod tests {
30433043
}
30443044

30453045
#[test]
3046-
fn test_get_opt() {
3046+
fn test_get() {
30473047
let mut a = ~[11];
3048-
assert_eq!(a.get_opt(1), None);
3048+
assert_eq!(a.get(1), None);
30493049
a = ~[11, 12];
3050-
assert_eq!(a.get_opt(1).unwrap(), &12);
3050+
assert_eq!(a.get(1).unwrap(), &12);
30513051
a = ~[11, 12, 13];
3052-
assert_eq!(a.get_opt(1).unwrap(), &12);
3052+
assert_eq!(a.get(1).unwrap(), &12);
30533053
}
30543054

30553055
#[test]

0 commit comments

Comments
 (0)