From 9b5bdfc2e2cb6928f9d592a3663fc8d090e5e3c6 Mon Sep 17 00:00:00 2001 From: Piotr Jawniak Date: Sun, 25 May 2014 11:41:20 +0200 Subject: [PATCH] Fix FIXME #3511 in Dlist code Issue #3511 was closed, but dlist.rs contained a FIXME for it. --- src/libcollections/dlist.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index c5fa8286f7d..8072ee02bc0 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -220,16 +220,13 @@ fn front_mut<'a>(&'a mut self) -> Option<&'a mut 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> = - 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 @@ fn next_back(&mut self) -> Option<&'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 -- 2.44.0