Skip to content

Fix FIXME #3511 in DList code #14417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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