Last test fails for exercise "Simple Linked List"

Exercise: simple-linked-list

Problem: in the last test test_into_vector code like this is executed:

let mut v = Vec::new();
let mut s = SimpleLinkedList::new();
for i in 1..4 {
    v.push(i);
    s.push(i);
}

However, because push appends to the back for vectors, but to the front for simply linked lists, this creates the vector v = [1, 2, 3] and the list s = [3, 2, 1]. This causes the test to fail with correct solutions.

Rust Playground

I think the idea is to reverse the vector in your

impl<T> From<SimpleLinkedList> for Vec<T> {}

Although one could reasonably argue that those semantics are wrong…

I’m torn on this, if we change the test, all existing exercises are guaranteed to be broken.

// In general, it would be preferable to implement IntoIterator for
// SimpleLinkedList<T> instead of implementing an explicit conversion to a
// vector. This is because, together, FromIterator and IntoIterator enable
// conversion between arbitrary collections. Given that implementation,
// converting to a vector is trivial:
//
// let vec: Vec<_> = simple_linked_list.into_iter().collect();
//
// The reason this exercise's API includes an explicit conversion to Vec<T>
// instead of IntoIterator is that implementing that interface is fairly
// complicated, and demands more of the student than we expect at this point in
// the track.

Maybe you could change the comment on that part of the exercise to mention that the test expects it reversed? I spent a bit more time debugging than I would have had the requirement been clear. This comment explicitly states that the result you would get when running SimpleLinkedList.into_iter().collect() is what is wanted, when clearly that is not what the test wants.

Good point, thanks. I created a PR. Feel free to suggest better phrasing.