mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
clippy on azalea-ecs-macros
This commit is contained in:
parent
27fce90682
commit
d4c8707e64
4 changed files with 10 additions and 15 deletions
|
@ -88,8 +88,7 @@ fn parse_component_attr(ast: &DeriveInput) -> Result<Attrs> {
|
|||
return Err(Error::new_spanned(
|
||||
m.lit,
|
||||
format!(
|
||||
"Invalid storage type `{}`, expected '{}' or '{}'.",
|
||||
s, TABLE, SPARSE_SET
|
||||
"Invalid storage type `{s}`, expected '{TABLE}' or '{SPARSE_SET}'."
|
||||
),
|
||||
))
|
||||
}
|
||||
|
|
|
@ -52,8 +52,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
|
|||
fetch_struct_attributes.is_mutable = true;
|
||||
} else {
|
||||
panic!(
|
||||
"The `{}` attribute is expected to have no value or arguments",
|
||||
MUTABLE_ATTRIBUTE_NAME
|
||||
"The `{MUTABLE_ATTRIBUTE_NAME}` attribute is expected to have no value or arguments"
|
||||
);
|
||||
}
|
||||
} else if ident == DERIVE_ATTRIBUTE_NAME {
|
||||
|
@ -63,8 +62,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
|
|||
.extend(meta_list.nested.iter().cloned());
|
||||
} else {
|
||||
panic!(
|
||||
"Expected a structured list within the `{}` attribute",
|
||||
DERIVE_ATTRIBUTE_NAME
|
||||
"Expected a structured list within the `{DERIVE_ATTRIBUTE_NAME}` attribute"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -27,8 +27,7 @@ pub fn get_lit_str(attr_name: Symbol, lit: &syn::Lit) -> syn::Result<&syn::LitSt
|
|||
Err(syn::Error::new_spanned(
|
||||
lit,
|
||||
format!(
|
||||
"expected {} attribute to be a string: `{} = \"...\"`",
|
||||
attr_name, attr_name
|
||||
"expected {attr_name} attribute to be a string: `{attr_name} = \"...\"`"
|
||||
),
|
||||
))
|
||||
}
|
||||
|
@ -41,8 +40,7 @@ pub fn get_lit_bool(attr_name: Symbol, lit: &syn::Lit) -> syn::Result<bool> {
|
|||
Err(syn::Error::new_spanned(
|
||||
lit,
|
||||
format!(
|
||||
"expected {} attribute to be a bool value, `true` or `false`: `{} = ...`",
|
||||
attr_name, attr_name
|
||||
"expected {attr_name} attribute to be a bool value, `true` or `false`: `{attr_name} = ...`"
|
||||
),
|
||||
))
|
||||
}
|
||||
|
|
|
@ -354,13 +354,13 @@ mod tests {
|
|||
))
|
||||
.id();
|
||||
{
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap().clone();
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
// y should start at 70
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
}
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap().clone();
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
// delta is applied before gravity, so the first tick only sets the delta
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
let entity_physics = app.world.get::<Physics>(entity).unwrap().clone();
|
||||
|
@ -368,7 +368,7 @@ mod tests {
|
|||
}
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap().clone();
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
// the second tick applies the delta to the position, so now it should go down
|
||||
assert!(
|
||||
entity_pos.y < 70.,
|
||||
|
@ -420,7 +420,7 @@ mod tests {
|
|||
);
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap().clone();
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
// delta will change, but it won't move until next tick
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
let entity_physics = app.world.get::<Physics>(entity).unwrap().clone();
|
||||
|
@ -428,7 +428,7 @@ mod tests {
|
|||
}
|
||||
app.update();
|
||||
{
|
||||
let entity_pos = app.world.get::<Position>(entity).unwrap().clone();
|
||||
let entity_pos = *app.world.get::<Position>(entity).unwrap();
|
||||
// the second tick applies the delta to the position, but it also does collision
|
||||
assert_eq!(entity_pos.y, 70.);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue