+
+ #[test]
+ fn test_iter_mut() {
+ let mut l = LinkedList::<i32>::new();
+ for i in 0..5 {
+ l.push_back(i);
+ }
+
+ assert_eq!(l.pop_front(), Some(0));
+ assert_eq!(l.pop_back(), Some(4));
+
+ for (n, i) in l.iter_mut().enumerate() {
+ *i-=1;
+ assert_eq!(n as i32, *i);
+ }
+ }