Recursively pop the last node from a singly linked list
Due to the Box, pattern matching with boxes is messy on stable. If you are willing to use nightly until box patterns are stabilized, you can rewrite your pop_back function (instead of just the pop_last_node function):

pub fn pop_back(&amp;mut self) -&gt; Result&lt;T, LinkedListError&gt; {
    fn pop_last_node&lt;T&gt;(node: &amp;mut NodePtr&lt;T&gt;) -&gt; Option&lt;T&gt; {
        match node.take() {
            None =&gt; None,
            // is a leaf
            Some(box Node { next: None, data }) =&gt; Some(data),
            Some(mut this) =&gt; {
                // recurse
                let ret = pop_last_node(&amp;mut this.next);
                // put this subnode back, since it's not a leaf
                *node = Some(this);
                ret
            }
        }
    }
    pop_last_node(&amp;mut self.head).ok_or(LinkedListError {
        kind: LinkedListErrorKind::Empty
    })
}


Try it out in the PlayPen



To make the above code work in stable, you can add an inner match instead of the box pattern.

match node.take() {
    None =&gt; None,
    Some(n) =&gt; match *n {
        // is a leaf
        Node { next: None, data } =&gt; Some(data),
        mut this =&gt; {
            // recurse
            let ret = pop_last_node(&amp;mut this.next);
            // put the subnode back, since it's not a leaf
            *node = Some(Box::new(this));
            ret
        }
    }
}