Skip to content

Commit

Permalink
Nightly clippy fixes (bevyengine#3491)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarthakSingh31 committed May 17, 2022
1 parent b1b3bd5 commit dbd856d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/query/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ impl<'w, T: Component> WorldQueryGats<'w> for &mut T {
type _State = WriteState<T>;
}

impl<'w, 's, T: Component> Fetch<'w> for WriteFetch<'w, T> {
impl<'w, T: Component> Fetch<'w> for WriteFetch<'w, T> {
type Item = Mut<'w, T>;
type State = WriteState<T>;

Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ unsafe impl ReadOnlySystemParamFetch for WorldState {}
#[doc(hidden)]
pub struct WorldState;

impl<'w, 's> SystemParam for &'w World {
impl<'w> SystemParam for &'w World {
type Fetch = WorldState;
}

unsafe impl<'w, 's> SystemParamState for WorldState {
unsafe impl SystemParamState for WorldState {
fn init(_world: &mut World, system_meta: &mut SystemMeta) -> Self {
let mut access = Access::default();
access.read_all();
Expand Down Expand Up @@ -1365,7 +1365,7 @@ impl<'w, 's, P: SystemParam> StaticSystemParam<'w, 's, P> {
pub struct StaticSystemParamState<S, P>(S, PhantomData<fn() -> P>);

// Safe: This doesn't add any more reads, and the delegated fetch confirms it
unsafe impl<'w, 's, S: ReadOnlySystemParamFetch, P> ReadOnlySystemParamFetch
unsafe impl<S: ReadOnlySystemParamFetch, P> ReadOnlySystemParamFetch
for StaticSystemParamState<S, P>
{
}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ where
}
}

unsafe impl<'w, 's, S: SystemParamState, P: SystemParam + 'static> SystemParamState
unsafe impl<S: SystemParamState, P: SystemParam + 'static> SystemParamState
for StaticSystemParamState<S, P>
{
fn init(world: &mut World, system_meta: &mut SystemMeta) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/world/world_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'w> Drop for WorldCell<'w> {
fn drop(&mut self) {
let mut access = self.access.borrow_mut();
// give world ArchetypeComponentAccess back to reuse allocations
let _ = std::mem::swap(&mut self.world.archetype_component_access, &mut *access);
std::mem::swap(&mut self.world.archetype_component_access, &mut *access);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl<'a> Iterator for ArrayIter<'a> {

impl<'a> ExactSizeIterator for ArrayIter<'a> {}

impl<'a> serde::Serialize for dyn Array {
impl serde::Serialize for dyn Array {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_render/src/view/visibility/render_layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl RenderLayers {
///
/// # Panics
/// Panics when called with a layer greater than `TOTAL_LAYERS - 1`.
#[must_use]
pub const fn with(mut self, layer: Layer) -> Self {
assert!((layer as usize) < Self::TOTAL_LAYERS);
self.0 |= 1 << layer;
Expand All @@ -86,6 +87,7 @@ impl RenderLayers {
///
/// # Panics
/// Panics when called with a layer greater than `TOTAL_LAYERS - 1`.
#[must_use]
pub const fn without(mut self, layer: Layer) -> Self {
assert!((layer as usize) < Self::TOTAL_LAYERS);
self.0 &= !(1 << layer);
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_transform/src/components/global_transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,23 @@ impl GlobalTransform {

#[doc(hidden)]
#[inline]
#[must_use]
pub const fn with_translation(mut self, translation: Vec3) -> Self {
self.translation = translation;
self
}

#[doc(hidden)]
#[inline]
#[must_use]
pub const fn with_rotation(mut self, rotation: Quat) -> Self {
self.rotation = rotation;
self
}

#[doc(hidden)]
#[inline]
#[must_use]
pub const fn with_scale(mut self, scale: Vec3) -> Self {
self.scale = scale;
self
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_transform/src/components/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,23 @@ impl Transform {

/// Returns this [`Transform`] with a new translation.
#[inline]
#[must_use]
pub const fn with_translation(mut self, translation: Vec3) -> Self {
self.translation = translation;
self
}

/// Returns this [`Transform`] with a new rotation.
#[inline]
#[must_use]
pub const fn with_rotation(mut self, rotation: Quat) -> Self {
self.rotation = rotation;
self
}

/// Returns this [`Transform`] with a new scale.
#[inline]
#[must_use]
pub const fn with_scale(mut self, scale: Vec3) -> Self {
self.scale = scale;
self
Expand Down

0 comments on commit dbd856d

Please sign in to comment.