Skip to content

Commit

Permalink
Review improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Xiyu Oh <xiyu@openrobotics.org>
  • Loading branch information
xiyuoh committed Jan 3, 2025
1 parent 1478654 commit 6067fef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
8 changes: 3 additions & 5 deletions rmf_site_editor/src/interaction/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,14 @@ impl Cursor {
model_instance: Option<ModelInstance<Entity>>,
) {
self.remove_preview(commands);
self.preview_model = if let Some(model_instance) = model_instance {
self.preview_model = model_instance.and_then(|model_instance| {
Some(
model_loader
.spawn_model_instance(self.frame, model_instance.clone())
.spawn_model_instance(self.frame, model_instance)
.insert(Pending)
.id(),
)
} else {
None
};
});
}

pub fn should_be_visible(&self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions rmf_site_editor/src/site/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ fn generate_site_entities(
} else {
error!(
"Model description missing for instance {}. This should \
not happen, please report this bug to the maintainers of \
rmf_site_editor.",
not happen, please report this bug to the maintainers of \
rmf_site_editor.",
model_instance.name.0,
);
}
Expand Down
5 changes: 1 addition & 4 deletions rmf_site_editor/src/site/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,7 @@ impl ModelLoadingServices {
.then(instance_spawn_request_into_model_load_request.into_blocking_callback())
.connect_on_err(scope.terminate)
.then(load_model)
.map_block(|res| match res {
Ok(success) => Ok(success),
Err(err) => Err(InstanceSpawningError::ModelError(err)),
})
.map_block(|res| res.map_err(InstanceSpawningError::ModelError))
.connect(scope.terminate)
});

Expand Down

0 comments on commit 6067fef

Please sign in to comment.