Linked list with removal function in Rust
Read Learning Rust With Entirely Too Many Linked Lists.
Your code has compilation errors with Rust 1.18.0.

error[E0446]: private type `Node&lt;T&gt;` in public interface
  --&gt; src/main.rs:82:5
   |
82 |     type Item = Rc&lt;RefCell&lt;Node&lt;T&gt;&gt;&gt;;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type

I derive Debug on almost every struct.
push can have all conditionals removed from it because doing
nothing is the same as setting None as the next value.
remove panics when called on a newly-created list.
pushing 1, 1, 1, 1, 2 and then removing 1 results in the list 2-&gt;1-&gt;1 which doesn't seem any flavor of correct. I assume you wanted to remove the first match.
It's way easier to get the code right when it operates on the same level of abstraction. I've created a method that removes on a &amp;mut Link&lt;T&gt; because that's the shared type between List and Link.
Honestly, it's also easier to get this right with recursive code as well.
Doesn't make sense to return the Rc&lt;RefCell&lt;...&gt;&gt; as the iterator type - people care about the values, not the collection.
Can simplify the iterator by just taking the value out of the iterator state and putting a new value in sometimes.




use std::rc::Rc;
use std::cell::RefCell;

type Link&lt;T&gt; = Option&lt;Rc&lt;RefCell&lt;Node&lt;T&gt;&gt;&gt;&gt;;

#[derive(Debug)]
pub struct Node&lt;T&gt; {
    elem: T,
    next: Link&lt;T&gt;,
}

impl&lt;T&gt; Node&lt;T&gt; {
    fn new(elem: T) -&gt; Rc&lt;RefCell&lt;Self&gt;&gt; {
        Rc::new(RefCell::new(Node {
            elem: elem,
            next: None,
        }))
    }
}

#[derive(Debug)]
pub struct List&lt;T&gt; {
    head: Link&lt;T&gt;,
}

impl&lt;T: Eq&gt; List&lt;T&gt; {
    pub fn new() -&gt; Self {
        List { head: None }
    }

    pub fn push(&amp;mut self, elem: T) {
        let new_head = Node::new(elem);
        new_head.borrow_mut().next = self.head.take();
        self.head = Some(new_head);
    }

    pub fn remove(&amp;mut self, elem: T) {
        fn remove_inner&lt;T: Eq&gt;(node: &amp;mut Link&lt;T&gt;, elem: T) {
            if let Some(ref mut n) = node.clone() {
                if elem == n.borrow().elem {
                    *node = n.borrow_mut().next.take();
                    return
                }

                remove_inner(&amp;mut n.borrow_mut().next, elem);
            }
        }

        remove_inner(&amp;mut self.head, elem)
    }
}

fn main1() {
    let mut list = List::new();
    list.push(3);
    list.push(2);
    list.push(1);
    list.remove(2);
    let head = list.head.unwrap().clone();
    assert_eq!(head.borrow().elem, 1);
    let next = head.borrow().next.clone().unwrap();
    assert_eq!(next.borrow().elem, 3);

    let mut list = List::new();
    list.remove(2);

    let mut list = List::new();
    list.push(1);
    list.push(1);
    list.push(1);
    list.push(1);
    list.push(2);
    list.remove(1);
    println!("{:?}", list);
}

pub struct Iter&lt;T&gt; {
    next: Link&lt;T&gt;,
}

impl&lt;T&gt; Iterator for Iter&lt;T&gt; {
    type Item = Rc&lt;RefCell&lt;Node&lt;T&gt;&gt;&gt;;

    fn next(&amp;mut self) -&gt; Option&lt;Self::Item&gt; {
        match self.next.take() {
            Some(next) =&gt; {
                self.next = next.borrow().next.clone();
                Some(next)
            }
            None =&gt; None,
        }
    }
}

impl&lt;T: Eq&gt; List&lt;T&gt; {
    pub fn iter(&amp;self) -&gt; Iter&lt;T&gt; {
        Iter { next: self.head.clone() }
    }
}

fn main2() {
    let mut list = List::new();
    list.push(3);
    list.push(2);
    list.push(1);
    list.remove(2);

    let mut it = list.iter();
    let next_node = it.next().unwrap();
    assert_eq!(next_node.borrow().elem, 1);
    let next_node = it.next().unwrap();
    assert_eq!(next_node.borrow().elem, 3);
    let next_node = it.next();
    assert_eq!(next_node.is_none(), true);
}

fn main() {
    main1();
    main2();
}


Frankly, I don't know why you used Rc and RefCell — they aren't needed to implement a singly linked list. There's no need for complicated shared ownership (no need for Rc) and there's no need for interior mutability (no need for RefCell).