Closed dwrensha closed 9 years ago
Hmm. Apparently this doesn't work. It fails on this program:
extern crate radix_trie;
use radix_trie::Trie;
fn main() {
let mut trie = Trie::new();
trie.insert("a", ());
trie.insert("p", ());
trie.remove(&"a");
assert_eq!(trie.len(), 1);
trie.remove(&"p");
assert_eq!(trie.len(), 0);
}
Thanks for finding this bug and submitting this patch!
I ended up fixing the problem by never having a Replace
action returned for the root. The root needs somewhat special handling in the current model as it isn't reached in a recursive traversal of child nodes. I think your patch didn't quite work because it changed the assumption that the root's key is always []
, which is relied upon in several places.
I think this fixes #11.