diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 973794c..2c18946 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,7 @@ on: push: branches: [ main ] pull_request: + branches: [ main ] jobs: clippy: diff --git a/src/trie.rs b/src/trie.rs index dc3dc35..fafb753 100644 --- a/src/trie.rs +++ b/src/trie.rs @@ -91,9 +91,10 @@ impl Trie { /// let another_data = "notintest".bytes(); /// assert_eq!(t.get_mut(data.clone()), None); /// t.insert(data.clone(), 42); - /// - /// assert_eq!(t.get_mut(data), Some(42).as_mut()); - /// assert_eq!(t.get(another_data), None); + /// if let Some(value) = t.get_mut(data.clone()) { + /// *value += 1; + /// } + /// assert_eq!(t.get_mut(data), Some(43).as_mut()); /// ``` pub fn get_mut>(&mut self, key: I) -> Option<&mut V> { self.find_node_mut(key).and_then(|node| node.get_value_mut())