Short rust solution
rust\npub fn delete_duplicates(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {\n    if head.is_none() { return head; }\n\n    let mut to_remove = head.a
```rust\npub fn delete_duplicates(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {\n    if head.is_none() { return head; }\n\n    let mut to_remove = head.as_ref().unwrap().val - 1;\n    let mut dummy = Some(Box::new(ListNode { next: head, val: to_remove, }));\n    let mut node = &mut dummy.as_mut().unwrap().next;\n\n    loop {\n        match node {\n            None => return dummy.unwrap().next,\n            Some(n) if n.val == to_remove => *node = n.next.take(),\n            Some(n) if n.next.is_some() && n.val == n.next.as_ref().unwrap().val => to_remove = n.val,\n            Some(n) => {\n                node = &mut n.next;\n                if let Some(n) = node { to_remove = n.val - 1; }\n            }\n        }\n    }\n}\n```\nIt\'s important to use pattern matching with conditions inside its branches, otherwise the ownership issues will drive you crazy.
[]