Refactor TODO list and improve error handling in RojoTree

- Removed outdated tasks related to scripts-only mode from the TODO list to streamline focus on current issues.
- Enhanced the remove method in RojoTree to prevent unnecessary operations when an ID does not exist.
- Improved error handling in the remove_metadata function to gracefully handle missing metadata.

These changes aim to optimize task management and enhance the robustness of the RojoTree implementation.
This commit is contained in:
Joe 2026-02-28 11:09:13 -06:00
parent 9d387d2a52
commit 9d6b48a53e
2 changed files with 7 additions and 4 deletions

View file

@ -158,6 +158,10 @@ impl RojoTree {
}
pub fn remove(&mut self, id: Ref) {
if self.inner.get_by_ref(id).is_none() {
return;
}
let mut to_move = VecDeque::new();
to_move.push_back(id);
@ -468,7 +472,9 @@ impl RojoTree {
/// Moves the Rojo metadata from the instance with the given ID from this
/// tree into some loose maps.
fn remove_metadata(&mut self, id: Ref) {
let metadata = self.metadata_map.remove(&id).unwrap();
let Some(metadata) = self.metadata_map.remove(&id) else {
return;
};
if let Some(specified) = metadata.specified_id {
self.specified_id_to_refs.remove(&specified, id);