Closed jtroo closed 1 year ago
Thanks for the work on this project!
I see a couple of instances where unwrap can be removed and replaced with only ?. As a general advice, unwrap can often be avoided and it is usually preferable to do so as a stylistic thing.
?
Two examples:
pub fn get<K: Key>(&self, key: &K) -> Option<&V> { self.root.as_ref()?; let root = self.root.as_ref().unwrap(); AdaptiveRadixTree::get_iterate(root, key) }
Could be written as
pub fn get<K: Key>(&self, key: &K) -> Option<&V> { AdaptiveRadixTree::get_iterate(self.root.as_ref()?, key) }
let next_node = cur_node.seek_child(k); next_node?; depth += cur_node.prefix.length(); cur_node = next_node.unwrap();
depth += cur_node.prefix.length() cur_node = cur_node.seek_child(k)?;
Done, thanks
Thanks for the work on this project!
I see a couple of instances where unwrap can be removed and replaced with only
?
. As a general advice, unwrap can often be avoided and it is usually preferable to do so as a stylistic thing.Two examples:
Could be written as
Could be written as