diff options
| author | Ubuntu <github@matdoes.dev> | 2022-08-30 19:56:14 +0000 |
|---|---|---|
| committer | Ubuntu <github@matdoes.dev> | 2022-08-30 19:56:14 +0000 |
| commit | a6c5017e387954342a65358347cf89deead68944 (patch) | |
| tree | a1d92d6bb9da42262a2b64cd8e390c8c6e6cbbed /azalea-world/src/lib.rs | |
| parent | 5f0fe9f29ed8f56c4a62ff89605623b74d8ec87b (diff) | |
| download | azalea-drasl-a6c5017e387954342a65358347cf89deead68944.tar.xz | |
clippy
Diffstat (limited to 'azalea-world/src/lib.rs')
| -rw-r--r-- | azalea-world/src/lib.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/azalea-world/src/lib.rs b/azalea-world/src/lib.rs index 77bb0f0f..93d2dcb2 100644 --- a/azalea-world/src/lib.rs +++ b/azalea-world/src/lib.rs @@ -123,23 +123,16 @@ impl Dimension { self.entity_storage.get_mut_by_id(id) } - pub fn entity<'d>(&'d self, id: u32) -> Option<EntityRef<'d>> { - let entity_data = self.entity_storage.get_by_id(id); - if let Some(entity_data) = entity_data { - Some(EntityRef::new(self, id, entity_data)) - } else { - None - } + pub fn entity(&self, id: u32) -> Option<EntityRef> { + let entity_data = self.entity_storage.get_by_id(id)?; + Some(EntityRef::new(self, id, entity_data)) } - pub fn entity_mut<'d>(&'d mut self, id: u32) -> Option<EntityMut<'d>> { - let entity_data = self.entity_storage.get_mut_by_id(id); - if let Some(entity_data) = entity_data { - let entity_ptr = unsafe { entity_data.as_ptr() }; - Some(EntityMut::new(self, id, entity_ptr)) - } else { - None - } + pub fn entity_mut(&mut self, id: u32) -> Option<EntityMut> { + let entity_data = self.entity_storage.get_mut_by_id(id)?; + + let entity_ptr = unsafe { entity_data.as_ptr() }; + Some(EntityMut::new(self, id, entity_ptr)) } pub fn entity_by_uuid(&self, uuid: &Uuid) -> Option<&EntityData> { |
