From ac6b27925edccdf90f2ef4b7464be6b6cb50fd7c Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Thu, 1 Jul 2021 18:05:20 -0700 Subject: [PATCH] fix clippy --- crates/bevy_app/src/ci_testing.rs | 12 +- crates/bevy_ecs/src/entity/mod.rs | 5 + crates/bevy_window/src/raw_window_handle.rs | 4 +- crates/crevice/crevice-derive/src/lib.rs | 6 +- crates/crevice/src/lib.rs | 2 + examples/2d/sprite.rs | 2 +- examples/tools/bevymark_pipelined.rs | 8 +- pipelined/bevy_pbr2/src/lib.rs | 2 +- pipelined/bevy_pbr2/src/render/light.rs | 10 +- pipelined/bevy_pbr2/src/render/mod.rs | 5 +- pipelined/bevy_render2/src/camera/mod.rs | 2 +- pipelined/bevy_render2/src/color/color.rs | 1234 ---------------- pipelined/bevy_render2/src/color/mod.rs | 1237 ++++++++++++++++- .../bevy_render2/src/core_pipeline/mod.rs | 24 +- pipelined/bevy_render2/src/mesh/mesh/mod.rs | 7 + .../bevy_render2/src/render_graph/context.rs | 18 +- .../bevy_render2/src/render_graph/graph.rs | 15 +- .../src/render_resource/uniform_vec.rs | 10 + pipelined/bevy_render2/src/texture/image.rs | 6 +- pipelined/bevy_sprite2/src/render/mod.rs | 5 +- 20 files changed, 1315 insertions(+), 1299 deletions(-) delete mode 100644 pipelined/bevy_render2/src/color/color.rs diff --git a/crates/bevy_app/src/ci_testing.rs b/crates/bevy_app/src/ci_testing.rs index 21e22bec04..dc8865a166 100644 --- a/crates/bevy_app/src/ci_testing.rs +++ b/crates/bevy_app/src/ci_testing.rs @@ -1,7 +1,6 @@ -use serde::Deserialize; - -use crate::{app::AppExit, AppBuilder}; +use crate::app::{App, AppExit}; use bevy_ecs::system::IntoSystem; +use serde::Deserialize; /// Configuration for automated testing on CI #[derive(Deserialize)] @@ -23,16 +22,15 @@ fn ci_testing_exit_after( *current_frame += 1; } -pub(crate) fn setup_app(app_builder: &mut AppBuilder) -> &mut AppBuilder { +pub(crate) fn setup_app(app: &mut App) -> &mut App { let filename = std::env::var("CI_TESTING_CONFIG").unwrap_or_else(|_| "ci_testing_config.ron".to_string()); let config: CiTestingConfig = ron::from_str( &std::fs::read_to_string(filename).expect("error reading CI testing configuration file"), ) .expect("error deserializing CI testing configuration file"); - app_builder - .insert_resource(config) + app.insert_resource(config) .add_system(ci_testing_exit_after.system()); - app_builder + app } diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index 7160ed6acc..7be98eac0e 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -428,6 +428,11 @@ impl Entities { /// Allocates space for entities previously reserved with `reserve_entity` or /// `reserve_entities`, then initializes each one using the supplied function. + /// + /// # Safety + /// Flush _must_ set the entity location to the correct ArchetypeId for the given Entity + /// each time init is called. This _can_ be ArchetypeId::invalid(), provided the Entity has + /// not been assigned to an Archetype. pub unsafe fn flush(&mut self, mut init: impl FnMut(Entity, &mut EntityLocation)) { let free_cursor = self.free_cursor.get_mut(); let current_free_cursor = *free_cursor; diff --git a/crates/bevy_window/src/raw_window_handle.rs b/crates/bevy_window/src/raw_window_handle.rs index 2393975490..76f1411261 100644 --- a/crates/bevy_window/src/raw_window_handle.rs +++ b/crates/bevy_window/src/raw_window_handle.rs @@ -15,7 +15,7 @@ impl RawWindowHandleWrapper { /// have constraints on where/how this handle can be used. For example, some platforms don't support doing window /// operations off of the main thread. The caller must ensure the [`RawWindowHandle`] is only used in valid contexts. pub unsafe fn get_handle(&self) -> HasRawWindowHandleWrapper { - HasRawWindowHandleWrapper(self.0.clone()) + HasRawWindowHandleWrapper(self.0) } } @@ -32,6 +32,6 @@ pub struct HasRawWindowHandleWrapper(RawWindowHandle); // SAFE: the caller has validated that this is a valid context to get RawWindowHandle unsafe impl HasRawWindowHandle for HasRawWindowHandleWrapper { fn raw_window_handle(&self) -> RawWindowHandle { - self.0.clone() + self.0 } } diff --git a/crates/crevice/crevice-derive/src/lib.rs b/crates/crevice/crevice-derive/src/lib.rs index ee7bfe1d34..a4fbac11ae 100644 --- a/crates/crevice/crevice-derive/src/lib.rs +++ b/crates/crevice/crevice-derive/src/lib.rs @@ -246,11 +246,7 @@ impl EmitOptions { // For testing purposes, we can optionally generate type layout // information using the type-layout crate. - let type_layout_derive = if cfg!(feature = "test_type_layout") { - quote!(#[derive(::type_layout::TypeLayout)]) - } else { - quote!() - }; + let type_layout_derive = quote!(); quote! { #[allow(non_snake_case)] diff --git a/crates/crevice/src/lib.rs b/crates/crevice/src/lib.rs index 89b7d4fddb..076f2c7ce4 100644 --- a/crates/crevice/src/lib.rs +++ b/crates/crevice/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(clippy::all)] + /*! [![GitHub CI Status](https://github.com/LPGhatguy/crevice/workflows/CI/badge.svg)](https://github.com/LPGhatguy/crevice/actions) [![crevice on crates.io](https://img.shields.io/crates/v/crevice.svg)](https://crates.io/crates/crevice) diff --git a/examples/2d/sprite.rs b/examples/2d/sprite.rs index b55e237133..5bfe05a225 100644 --- a/examples/2d/sprite.rs +++ b/examples/2d/sprite.rs @@ -9,7 +9,7 @@ fn main() { fn setup( mut commands: Commands, - asset_server: Res, + _asset_server: Res, // mut materials: ResMut>, ) { // let texture_handle = asset_server.load("branding/icon.png"); diff --git a/examples/tools/bevymark_pipelined.rs b/examples/tools/bevymark_pipelined.rs index 4789853fe3..b2e80850e3 100644 --- a/examples/tools/bevymark_pipelined.rs +++ b/examples/tools/bevymark_pipelined.rs @@ -13,7 +13,7 @@ use bevy::{ use rand::Rng; const BIRDS_PER_SECOND: u32 = 10000; -const BASE_COLOR: Color = Color::rgb(5.0, 5.0, 5.0); +const _BASE_COLOR: Color = Color::rgb(5.0, 5.0, 5.0); const GRAVITY: f32 = -9.8 * 100.0; const MAX_VELOCITY: f32 = 750.; const BIRD_SCALE: f32 = 0.15; @@ -66,8 +66,8 @@ struct BirdTexture(Handle); fn setup( mut commands: Commands, - window: Res, - mut counter: ResMut, + _window: Res, + _counter: ResMut, asset_server: Res, ) { // spawn_birds(&mut commands, &window, &mut counter, 10); @@ -129,7 +129,7 @@ fn setup( #[allow(clippy::too_many_arguments)] fn mouse_handler( mut commands: Commands, - asset_server: Res, + _asset_server: Res, time: Res