auto merge of #14417 : Sawyer47/rust/dlist-fixme, r=huonw

Issue #3511 was closed, but dlist.rs contained a FIXME for it.
This commit is contained in:
bors 2014-05-25 05:01:18 -07:00
commit 759517c180

View File

@ -220,16 +220,13 @@ impl<T> Deque<T> for DList<T> {
/// Provide a reference to the back element, or None if the list is empty
#[inline]
fn back<'a>(&'a self) -> Option<&'a T> {
let tmp = self.list_tail.resolve_immut(); // FIXME: #3511: shouldn't need variable
tmp.as_ref().map(|tail| &tail.value)
self.list_tail.resolve_immut().as_ref().map(|tail| &tail.value)
}
/// Provide a mutable reference to the back element, or None if the list is empty
#[inline]
fn back_mut<'a>(&'a mut self) -> Option<&'a mut T> {
let tmp: Option<&'a mut Node<T>> =
self.list_tail.resolve(); // FIXME: #3511: shouldn't need variable
tmp.map(|tail| &mut tail.value)
self.list_tail.resolve().map(|tail| &mut tail.value)
}
/// Add an element first in the list
@ -449,8 +446,7 @@ impl<'a, A> DoubleEndedIterator<&'a A> for Items<'a, A> {
if self.nelem == 0 {
return None;
}
let tmp = self.tail.resolve_immut(); // FIXME: #3511: shouldn't need variable
tmp.as_ref().map(|prev| {
self.tail.resolve_immut().as_ref().map(|prev| {
self.nelem -= 1;
self.tail = prev.prev;
&prev.value