Fixed style and typos

This commit is contained in:
vil'mo 2024-10-13 17:50:23 +07:00
parent 504a500bfc
commit 1d47074192
3 changed files with 19 additions and 21 deletions

View file

@ -419,10 +419,10 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream {
pub fn impl_data_set(_input: TokenStream) -> TokenStream { pub fn impl_data_set(_input: TokenStream) -> TokenStream {
let mut tokens = TokenStream::new(); let mut tokens = TokenStream::new();
let max_members = 8; let max_members = 8;
let datas = get_idents(|i| format!("D{i}"), max_members); let data_types = get_idents(|i| format!("D{i}"), max_members);
let accesses = get_idents(|i| format!("access{i}"), max_members); let accesses = get_idents(|i| format!("access{i}"), max_members);
let mut member_fn_muts = Vec::new(); let mut member_fn_muts = Vec::new();
for (i, data) in datas.iter().enumerate() { for (i, data) in data_types.iter().enumerate() {
let fn_name = Ident::new(&format!("d{i}"), Span::call_site()); let fn_name = Ident::new(&format!("d{i}"), Span::call_site());
let index = Index::from(i); let index = Index::from(i);
let ordinal = match i { let ordinal = match i {
@ -431,8 +431,7 @@ pub fn impl_data_set(_input: TokenStream) -> TokenStream {
3 => "3rd".to_owned(), 3 => "3rd".to_owned(),
x => format!("{x}th"), x => format!("{x}th"),
}; };
let comment = let comment = format!("Gets exclusive access to the {ordinal} member of this [`DataSet`].");
format!("Gets exclusive access to the {ordinal} member of this [`DataSet`].");
member_fn_muts.push(quote! { member_fn_muts.push(quote! {
#[doc = #comment] #[doc = #comment]
/// No other members may be accessed while this one is active. /// No other members may be accessed while this one is active.
@ -450,7 +449,7 @@ pub fn impl_data_set(_input: TokenStream) -> TokenStream {
} }
for member_count in 1..=max_members { for member_count in 1..=max_members {
let data = &datas[0..member_count]; let data = &data_types[0..member_count];
let access = &accesses[0..member_count]; let access = &accesses[0..member_count];
let member_fn_mut = &member_fn_muts[0..member_count]; let member_fn_mut = &member_fn_muts[0..member_count];
tokens.extend(TokenStream::from(quote! { tokens.extend(TokenStream::from(quote! {

View file

@ -320,7 +320,7 @@ mod tests {
component::{Component, Components, Tick}, component::{Component, Components, Tick},
entity::{Entities, Entity}, entity::{Entities, Entity},
prelude::{AnyOf, EntityRef}, prelude::{AnyOf, EntityRef},
query::{Added, Changed, Or, With, Without, DataSet}, query::{Added, Changed, DataSet, Or, With, Without},
removal_detection::RemovedComponents, removal_detection::RemovedComponents,
schedule::{ schedule::{
apply_deferred, common_conditions::resource_exists, Condition, IntoSystemConfigs, apply_deferred, common_conditions::resource_exists, Condition, IntoSystemConfigs,
@ -810,7 +810,6 @@ mod tests {
run_system(&mut world, sys); run_system(&mut world, sys);
} }
#[test] #[test]
fn data_set_system() { fn data_set_system() {
fn sys(mut _query: Query<DataSet<(&mut A, &A)>>) {} fn sys(mut _query: Query<DataSet<(&mut A, &A)>>) {}