I wasn't familiar with the concept of tail recursion so didn't understand Section 2.7 fully, but this is what I came up with for implementing the Drop trait:
impl Drop for List {
fn drop(&mut self) {
while let Link::More(node) = mem::replace(&mut self.head, Link::Empty) {
self.head = node.next;
}
}
}
Q: Is it logically equivalent to the code in the book? If so, this is more elegant imo.