Skip to content

Commit 9bc7cfe

Browse files
committed
remove use of unwrap
Signed-off-by: Teo Koon Peng <[email protected]>
1 parent 1137c08 commit 9bc7cfe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

macros/src/buffers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
3030
) -> Result<usize, OperationError> {
3131
#(
3232
let #field_ident = world
33-
.get_entity(buffers.get(#map_key).unwrap().id())
33+
.get_entity(buffers.get(#map_key).or_broken()?.id())
3434
.or_broken()?
3535
.buffered_count::<#field_type>(session)?;
3636
)*
@@ -49,7 +49,7 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
4949
) -> OperationResult {
5050
#(
5151
world
52-
.get_entity_mut(buffers.get(#map_key).unwrap().id())
52+
.get_entity_mut(buffers.get(#map_key).or_broken()?.id())
5353
.or_broken()?
5454
.ensure_session::<#field_type>(session)?;
5555
)*
@@ -68,7 +68,7 @@ pub(crate) fn impl_buffer_map_layout(ast: DeriveInput) -> Result<TokenStream> {
6868
) -> Result<Self, OperationError> {
6969
#(
7070
let #field_ident = world
71-
.get_entity_mut(buffers.get(#map_key).unwrap().id())
71+
.get_entity_mut(buffers.get(#map_key).or_broken()?.id())
7272
.or_broken()?
7373
.pull_from_buffer::<#field_type>(session)?;
7474
)*

0 commit comments

Comments
 (0)