Skip to content

Commit

Permalink
Fix FIXME rust-lang#3511 in Dlist code
Browse files Browse the repository at this point in the history
Issue rust-lang#3511 was closed, but dlist.rs contained a FIXME for it.
  • Loading branch information
Sawyer47 committed May 25, 2014
1 parent 7d76d0a commit 9b5bdfc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9b5bdfc

Please sign in to comment.