Currently the register method checks if a path is already in the dashmap. If it is, it calls replace which returns the old value if one was present. If the old value was present, it replaces the old value again.
Because the value is always () and replace already handles the case where a path is already registered, this method can be simplified which should make reasoning about the code easier.
This should also make it a bit faster, because it removes duplicate calls to replace and one one unnecessary call to contains_key.
Currently the register method checks if a path is already in the dashmap. If it is, it calls replace which returns the old value if one was present. If the old value was present, it replaces the old value again.
Because the value is always
()
and replace already handles the case where a path is already registered, this method can be simplified which should make reasoning about the code easier. This should also make it a bit faster, because it removes duplicate calls to replace and one one unnecessary call to contains_key.