diff options
Diffstat (limited to '')
-rw-r--r-- | pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs index a5f94067..21392388 100644 --- a/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs +++ b/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs @@ -10,7 +10,7 @@ use anyhow::Result; use keymaps::map_tree::{Node, Trie}; -use log::{debug, log_enabled, trace, Level}; +use log::{Level, debug, log_enabled, trace}; use map_key::MapKey; pub mod lf_mapping; @@ -130,7 +130,7 @@ impl MappingsTrie { { let mut full_foreign_keys = parent_keys.to_vec(); full_foreign_keys.append(&mut foreign_keys); - self.0.insert_node(&full_foreign_keys, &other_node)?; + self.insert_node(&full_foreign_keys, other_node)?; } } } @@ -138,13 +138,13 @@ impl MappingsTrie { { let mut full_our_keys = parent_keys.to_vec(); full_our_keys.append(&mut our_keys); - self.0.insert_node(&full_our_keys, &node)?; + self.insert_node(&full_our_keys, node)?; } Ok(()) } keymaps::error::TrieInsert::KeyIncludesChild { - mut child_key, + child_key: key, child_value, } => { // A node that should be a parent was classified @@ -154,6 +154,16 @@ impl MappingsTrie { // 2. Add the child node to the parent node as child, but with a '.' as MapKey. // 3. Add the original node also as child to the parent node. + assert_eq!(key, keys); + + let (fetched_child_value, mut child_key) = self.0.try_get(keys); + assert_eq!(fetched_child_value.value(), Some(&child_value)); + + trace!( + "Replacing child ('{}') with a parent, so that we can continue from this point.", + MapKey::display(&child_key) + ); + let child = self .0 .replace_node(&child_key, Node::new_parent()) |