提交 74d2552b 编写于 作者: E Erick Tryzelaar

std: Iterator.last_ -> .last

上级 1db62d83
......@@ -381,9 +381,8 @@ fn nth(&mut self, mut n: uint) -> Option<A> {
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().last().get() == &5);
/// ~~~
// FIXME: #5898: should be called `last`
#[inline]
fn last_(&mut self) -> Option<A> {
fn last(&mut self) -> Option<A> {
let mut last = None;
for x in *self { last = Some(x); }
last
......@@ -1712,8 +1711,8 @@ fn test_iterator_nth() {
#[test]
fn test_iterator_last() {
let v = &[0, 1, 2, 3, 4];
assert_eq!(v.iter().last_().unwrap(), &4);
assert_eq!(v.slice(0, 1).iter().last_().unwrap(), &0);
assert_eq!(v.iter().last().unwrap(), &4);
assert_eq!(v.slice(0, 1).iter().last().unwrap(), &0);
}
#[test]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册