Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bash committed Aug 12, 2024
1 parent a2b354e commit 583eeed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@ impl<C: Component> DynamicBundle for C {

macro_rules! tuple_impl {
($(#[$meta:meta])* $($name: ident),*) => {
$(#[$meta])*
// SAFETY:
// - `Bundle::component_ids` calls `ids` for each component type in the
// bundle, in the exact order that `DynamicBundle::get_components` is called.
// - `Bundle::from_components` calls `func` exactly once for each `ComponentId` returned by `Bundle::component_ids`.
// - `Bundle::get_components` is called exactly once for each member. Relies on the above implementation to pass the correct
// `StorageType` into the callback.
$(#[$meta])*
unsafe impl<$($name: Bundle),*> Bundle for ($($name,)*) {
#[allow(unused_variables)]
fn component_ids(components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId)){
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/query/world_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ macro_rules! impl_tuple_world_query {

#[allow(non_snake_case)]
#[allow(clippy::unused_unit)]
$(#[$meta])*
/// SAFETY:
/// `fetch` accesses are the conjunction of the subqueries' accesses
/// This is sound because `update_component_access` adds accesses according to the implementations of all the subqueries.
/// `update_component_access` adds all `With` and `Without` filters from the subqueries.
/// This is sound because `matches_component_set` always returns `false` if any the subqueries' implementations return `false`.
$(#[$meta])*
unsafe impl<$($name: WorldQuery),*> WorldQuery for ($($name,)*) {
type Fetch<'w> = ($($name::Fetch<'w>,)*);
type Item<'w> = ($($name::Item<'w>,)*);
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ fn assert_component_access_compatibility(
/// # let _event = event;
/// }
/// set.p1().send(MyEvent::new());
///
///
/// let entities = set.p2().entities();
/// // ...
/// # let _entities = entities;
Expand Down Expand Up @@ -1472,8 +1472,8 @@ unsafe impl SystemParam for SystemChangeTick {

macro_rules! impl_system_param_tuple {
($(#[$meta:meta])* $($param: ident),*) => {
// SAFETY: tuple consists only of ReadOnlySystemParams
$(#[$meta])*
// SAFETY: tuple consists only of ReadOnlySystemParams
unsafe impl<$($param: ReadOnlySystemParam),*> ReadOnlySystemParam for ($($param,)*) {}

// SAFETY: implementors of each `SystemParam` in the tuple have validated their impls
Expand Down
12 changes: 4 additions & 8 deletions crates/bevy_utils/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl Parse for AllTuples {
///
/// impl Variadic for () {}
///
/// macro_rules! impl_append {
/// macro_rules! impl_variadic {
/// ($(#[$meta:meta])* $(($P:ident, $p:ident)),*) => {
/// $(#[$meta])*
/// impl<$($P),*> Variadic for ($($P,)*) {}
Expand Down Expand Up @@ -230,7 +230,7 @@ pub fn all_tuples_with_size(input: TokenStream) -> TokenStream {
/// Parses the attribute `#[doc(fake_variadic)]`
fn parse_fake_variadic_attr(input: ParseStream) -> Result<bool> {
let attribute = match input.call(Attribute::parse_outer)? {
attributes if attributes.len() == 0 => return Ok(false),
attributes if attributes.is_empty() => return Ok(false),
attributes if attributes.len() == 1 => attributes[0].clone(),
attributes => {
return Err(Error::new(
Expand All @@ -249,7 +249,7 @@ fn parse_fake_variadic_attr(input: ParseStream) -> Result<bool> {

Err(Error::new(
attribute.meta.span(),
format!("Unexpected attribute"),
"Unexpected attribute".to_string(),
))
}

Expand All @@ -261,11 +261,7 @@ fn to_ident_tuple(idents: impl Iterator<Item = Ident>, len: usize) -> TokenStrea
}
}

fn choose_ident_tuples<'a>(
input: &AllTuples,
ident_tuples: &'a [TokenStream2],
i: usize,
) -> TokenStream2 {
fn choose_ident_tuples(input: &AllTuples, ident_tuples: &[TokenStream2], i: usize) -> TokenStream2 {
// `rustdoc` uses the first ident to generate nice
// idents with subscript numbers e.g. (F₁, F₂, …, Fₙ).
// We don't want two numbers, so we use the
Expand Down

0 comments on commit 583eeed

Please sign in to comment.