diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-20 21:32:46 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-20 21:32:46 +0200 |
commit | 681fca5c465191e37714ed07937efec8b0c8b197 (patch) | |
tree | fd609df5737a678a32c2bbe17315f1e163a23d48 /ecs/src/component.rs | |
parent | 87a4230d5cbe8741c88edecbecff510bc1736fef (diff) |
refactor(ecs): fix Clippy lints
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r-- | ecs/src/component.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 512c60d..be5756f 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -121,6 +121,7 @@ pub struct Id impl Id { + #[must_use] pub fn of<ComponentT>() -> Self where ComponentT: Component, @@ -168,6 +169,7 @@ impl From<bool> for IsOptional /// Returns whether the given component type is a optional component. /// /// Will return `true` if the component is a [`Option`]. +#[must_use] pub fn is_optional<ComponentT: Component>() -> bool { if Id::of::<ComponentT>() == Id::of::<Option<ComponentT::Component>>() { @@ -177,7 +179,7 @@ pub fn is_optional<ComponentT: Component>() -> bool false } -pub trait FromOptionalComponent<'comp> +pub trait FromOptional<'comp> { fn from_optional_component( optional_component: Option<WriteGuard<'comp, Box<dyn Component>>>, @@ -189,7 +191,7 @@ macro_rules! inner { seq!(I in 0..=$c { impl<#(Comp~I: Component,)*> Sequence for (#(Comp~I,)*) where - #(for<'comp> Comp~I::RefMut<'comp>: FromOptionalComponent<'comp>,)* + #(for<'comp> Comp~I::RefMut<'comp>: FromOptional<'comp>,)* { type Refs<'component> = (#(Comp~I::RefMut<'component>,)*) where Self: 'component; |