Fix clippy lints for 1.57 (#3238)
# Objective - New clippy lints with rust 1.57 are failing ## Solution - Fixed clippy lints following suggestions - I ignored clippy in old renderer because there was many and it will be removed soon
This commit is contained in:
parent
ccee658436
commit
c6fec1f0c2
@ -18,7 +18,7 @@ impl<'a> AssetPath<'a> {
|
|||||||
pub fn new_ref(path: &'a Path, label: Option<&'a str>) -> AssetPath<'a> {
|
pub fn new_ref(path: &'a Path, label: Option<&'a str>) -> AssetPath<'a> {
|
||||||
AssetPath {
|
AssetPath {
|
||||||
path: Cow::Borrowed(path),
|
path: Cow::Borrowed(path),
|
||||||
label: label.map(|val| Cow::Borrowed(val)),
|
label: label.map(Cow::Borrowed),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ impl<'a> From<&'a str> for AssetPath<'a> {
|
|||||||
let label = parts.next();
|
let label = parts.next();
|
||||||
AssetPath {
|
AssetPath {
|
||||||
path: Cow::Borrowed(path),
|
path: Cow::Borrowed(path),
|
||||||
label: label.map(|label| Cow::Borrowed(label)),
|
label: label.map(Cow::Borrowed),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ impl<'a, 'b> BundleInserter<'a, 'b> {
|
|||||||
// redundant copies
|
// redundant copies
|
||||||
let move_result = self
|
let move_result = self
|
||||||
.table
|
.table
|
||||||
.move_to_superset_unchecked(result.table_row, &mut *new_table);
|
.move_to_superset_unchecked(result.table_row, *new_table);
|
||||||
let new_location = new_archetype.allocate(entity, move_result.new_row);
|
let new_location = new_archetype.allocate(entity, move_result.new_row);
|
||||||
self.entities.meta[entity.id as usize].location = new_location;
|
self.entities.meta[entity.id as usize].location = new_location;
|
||||||
|
|
||||||
|
@ -132,7 +132,11 @@ pub unsafe trait FetchState: Send + Sync + Sized {
|
|||||||
fn matches_table(&self, table: &Table) -> bool;
|
fn matches_table(&self, table: &Table) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A fetch that is read only. This must only be implemented for read-only fetches.
|
/// A fetch that is read only.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// This must only be implemented for read-only fetches.
|
||||||
pub unsafe trait ReadOnlyFetch {}
|
pub unsafe trait ReadOnlyFetch {}
|
||||||
|
|
||||||
impl WorldQuery for Entity {
|
impl WorldQuery for Entity {
|
||||||
|
@ -396,22 +396,13 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct RunOnce {
|
pub struct RunOnce {
|
||||||
ran: bool,
|
ran: bool,
|
||||||
archetype_component_access: Access<ArchetypeComponentId>,
|
archetype_component_access: Access<ArchetypeComponentId>,
|
||||||
component_access: Access<ComponentId>,
|
component_access: Access<ComponentId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RunOnce {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
ran: false,
|
|
||||||
archetype_component_access: Default::default(),
|
|
||||||
component_access: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl System for RunOnce {
|
impl System for RunOnce {
|
||||||
type In = ();
|
type In = ();
|
||||||
type Out = ShouldRun;
|
type Out = ShouldRun;
|
||||||
|
@ -6,6 +6,7 @@ use crate::schedule::{
|
|||||||
use super::IntoSystemDescriptor;
|
use super::IntoSystemDescriptor;
|
||||||
|
|
||||||
/// A builder for describing several systems at the same time.
|
/// A builder for describing several systems at the same time.
|
||||||
|
#[derive(Default)]
|
||||||
pub struct SystemSet {
|
pub struct SystemSet {
|
||||||
pub(crate) systems: Vec<SystemDescriptor>,
|
pub(crate) systems: Vec<SystemDescriptor>,
|
||||||
pub(crate) run_criteria: Option<RunCriteriaDescriptorOrLabel>,
|
pub(crate) run_criteria: Option<RunCriteriaDescriptorOrLabel>,
|
||||||
@ -15,19 +16,6 @@ pub struct SystemSet {
|
|||||||
pub(crate) ambiguity_sets: Vec<BoxedAmbiguitySetLabel>,
|
pub(crate) ambiguity_sets: Vec<BoxedAmbiguitySetLabel>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SystemSet {
|
|
||||||
fn default() -> SystemSet {
|
|
||||||
SystemSet {
|
|
||||||
systems: Vec::new(),
|
|
||||||
run_criteria: None,
|
|
||||||
labels: Vec::new(),
|
|
||||||
before: Vec::new(),
|
|
||||||
after: Vec::new(),
|
|
||||||
ambiguity_sets: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SystemSet {
|
impl SystemSet {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Default::default()
|
Default::default()
|
||||||
|
@ -2,9 +2,9 @@ error[E0499]: cannot borrow `query` as mutable more than once at a time
|
|||||||
--> tests/ui/system_query_get_lifetime_safety.rs:8:14
|
--> tests/ui/system_query_get_lifetime_safety.rs:8:14
|
||||||
|
|
|
|
||||||
7 | let a1 = query.get_mut(*e).unwrap();
|
7 | let a1 = query.get_mut(*e).unwrap();
|
||||||
| ----- first mutable borrow occurs here
|
| ----------------- first mutable borrow occurs here
|
||||||
8 | let a2 = query.get_mut(*e).unwrap();
|
8 | let a2 = query.get_mut(*e).unwrap();
|
||||||
| ^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
9 | // this should fail to compile
|
9 | // this should fail to compile
|
||||||
10 | println!("{} {}", a1.0, a2.0);
|
10 | println!("{} {}", a1.0, a2.0);
|
||||||
| -- first borrow later used here
|
| -- first borrow later used here
|
||||||
|
@ -2,10 +2,10 @@ error[E0499]: cannot borrow `query` as mutable more than once at a time
|
|||||||
--> tests/ui/system_query_iter_lifetime_safety.rs:10:21
|
--> tests/ui/system_query_iter_lifetime_safety.rs:10:21
|
||||||
|
|
|
|
||||||
7 | let mut iter = query.iter_mut();
|
7 | let mut iter = query.iter_mut();
|
||||||
| ----- first mutable borrow occurs here
|
| ---------------- first mutable borrow occurs here
|
||||||
...
|
...
|
||||||
10 | let mut iter2 = query.iter_mut();
|
10 | let mut iter2 = query.iter_mut();
|
||||||
| ^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
14 | println!("{}", a.0);
|
14 | println!("{}", a.0);
|
||||||
| --- first borrow later used here
|
| --- first borrow later used here
|
||||||
|
@ -2,10 +2,10 @@ error[E0499]: cannot borrow `queries` as mutable more than once at a time
|
|||||||
--> tests/ui/system_query_set_get_lifetime_safety.rs:10:14
|
--> tests/ui/system_query_set_get_lifetime_safety.rs:10:14
|
||||||
|
|
|
|
||||||
7 | let mut q2 = queries.q0();
|
7 | let mut q2 = queries.q0();
|
||||||
| ------- first mutable borrow occurs here
|
| ------------ first mutable borrow occurs here
|
||||||
...
|
...
|
||||||
10 | let q1 = queries.q1();
|
10 | let q1 = queries.q1();
|
||||||
| ^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
14 | b.0 = a.0
|
14 | b.0 = a.0
|
||||||
| - first borrow later used here
|
| - first borrow later used here
|
||||||
@ -14,10 +14,10 @@ error[E0499]: cannot borrow `queries` as mutable more than once at a time
|
|||||||
--> tests/ui/system_query_set_get_lifetime_safety.rs:21:18
|
--> tests/ui/system_query_set_get_lifetime_safety.rs:21:18
|
||||||
|
|
|
|
||||||
18 | let q1 = queries.q1();
|
18 | let q1 = queries.q1();
|
||||||
| ------- first mutable borrow occurs here
|
| ------------ first mutable borrow occurs here
|
||||||
...
|
...
|
||||||
21 | let mut q2 = queries.q0();
|
21 | let mut q2 = queries.q0();
|
||||||
| ^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
25 | b.0 = a.0
|
25 | b.0 = a.0
|
||||||
| --- first borrow later used here
|
| --- first borrow later used here
|
||||||
|
@ -2,10 +2,10 @@ error[E0499]: cannot borrow `queries` as mutable more than once at a time
|
|||||||
--> tests/ui/system_query_set_iter_lifetime_safety.rs:11:14
|
--> tests/ui/system_query_set_iter_lifetime_safety.rs:11:14
|
||||||
|
|
|
|
||||||
7 | let mut q2 = queries.q0();
|
7 | let mut q2 = queries.q0();
|
||||||
| ------- first mutable borrow occurs here
|
| ------------ first mutable borrow occurs here
|
||||||
...
|
...
|
||||||
11 | let q1 = queries.q1();
|
11 | let q1 = queries.q1();
|
||||||
| ^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
16 | b.0 = a.0
|
16 | b.0 = a.0
|
||||||
| - first borrow later used here
|
| - first borrow later used here
|
||||||
@ -14,10 +14,10 @@ error[E0499]: cannot borrow `queries` as mutable more than once at a time
|
|||||||
--> tests/ui/system_query_set_iter_lifetime_safety.rs:24:18
|
--> tests/ui/system_query_set_iter_lifetime_safety.rs:24:18
|
||||||
|
|
|
|
||||||
20 | let q1 = queries.q1();
|
20 | let q1 = queries.q1();
|
||||||
| ------- first mutable borrow occurs here
|
| ------------ first mutable borrow occurs here
|
||||||
...
|
...
|
||||||
24 | let mut q2 = queries.q0();
|
24 | let mut q2 = queries.q0();
|
||||||
| ^^^^^^^ second mutable borrow occurs here
|
| ^^^^^^^^^^^^ second mutable borrow occurs here
|
||||||
...
|
...
|
||||||
29 | b.0 = a.0;
|
29 | b.0 = a.0;
|
||||||
| --- first borrow later used here
|
| --- first borrow later used here
|
||||||
|
@ -2,10 +2,10 @@ error[E0502]: cannot borrow `query` as immutable because it is also borrowed as
|
|||||||
--> tests/ui/system_state_iter_mut_overlap_safety.rs:18:13
|
--> tests/ui/system_state_iter_mut_overlap_safety.rs:18:13
|
||||||
|
|
|
|
||||||
15 | let mut_vec = query.iter_mut().collect::<Vec<bevy_ecs::prelude::Mut<A>>>();
|
15 | let mut_vec = query.iter_mut().collect::<Vec<bevy_ecs::prelude::Mut<A>>>();
|
||||||
| ----- mutable borrow occurs here
|
| ---------------- mutable borrow occurs here
|
||||||
...
|
...
|
||||||
18 | query.iter().collect::<Vec<&A>>(),
|
18 | query.iter().collect::<Vec<&A>>(),
|
||||||
| ^^^^^ immutable borrow occurs here
|
| ^^^^^^^^^^^^ immutable borrow occurs here
|
||||||
...
|
...
|
||||||
23 | mut_vec.iter().map(|m| **m).collect::<Vec<A>>(),
|
23 | mut_vec.iter().map(|m| **m).collect::<Vec<A>>(),
|
||||||
| ------- mutable borrow later used here
|
| -------------- mutable borrow later used here
|
||||||
|
@ -354,9 +354,7 @@ async fn load_texture<'a>(
|
|||||||
|
|
||||||
Texture::from_buffer(
|
Texture::from_buffer(
|
||||||
&bytes,
|
&bytes,
|
||||||
mime_type
|
mime_type.map(ImageType::MimeType).unwrap_or(image_type),
|
||||||
.map(|mt| ImageType::MimeType(mt))
|
|
||||||
.unwrap_or(image_type),
|
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#![allow(clippy::all)]
|
||||||
pub mod camera;
|
pub mod camera;
|
||||||
pub mod color;
|
pub mod color;
|
||||||
pub mod colorspace;
|
pub mod colorspace;
|
||||||
|
@ -38,7 +38,7 @@ use bevy_render::{
|
|||||||
};
|
};
|
||||||
use sprite::sprite_system;
|
use sprite::sprite_system;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct SpriteSettings {
|
pub struct SpriteSettings {
|
||||||
/// Enable sprite frustum culling.
|
/// Enable sprite frustum culling.
|
||||||
///
|
///
|
||||||
@ -47,14 +47,6 @@ pub struct SpriteSettings {
|
|||||||
pub frustum_culling_enabled: bool,
|
pub frustum_culling_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SpriteSettings {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
frustum_culling_enabled: false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct SpritePlugin;
|
pub struct SpritePlugin;
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
clippy::new_without_default,
|
clippy::new_without_default,
|
||||||
clippy::needless_update,
|
clippy::needless_update,
|
||||||
clippy::len_without_is_empty,
|
clippy::len_without_is_empty,
|
||||||
clippy::needless_range_loop
|
clippy::needless_range_loop,
|
||||||
|
clippy::all
|
||||||
)]
|
)]
|
||||||
/*!
|
/*!
|
||||||
[](https://github.com/LPGhatguy/crevice/actions)
|
[](https://github.com/LPGhatguy/crevice/actions)
|
||||||
|
@ -354,9 +354,7 @@ async fn load_texture<'a>(
|
|||||||
|
|
||||||
Image::from_buffer(
|
Image::from_buffer(
|
||||||
&bytes,
|
&bytes,
|
||||||
mime_type
|
mime_type.map(ImageType::MimeType).unwrap_or(image_type),
|
||||||
.map(|mt| ImageType::MimeType(mt))
|
|
||||||
.unwrap_or(image_type),
|
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@ use bevy_render2::{
|
|||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
use bevy_transform::components::{GlobalTransform, Transform};
|
||||||
|
|
||||||
/// A component bundle for PBR entities with a [`Mesh`] and a [`StandardMaterial`].
|
/// A component bundle for PBR entities with a [`Mesh`] and a [`StandardMaterial`].
|
||||||
#[derive(Bundle, Clone)]
|
#[derive(Bundle, Clone, Default)]
|
||||||
pub struct PbrBundle {
|
pub struct PbrBundle {
|
||||||
pub mesh: Handle<Mesh>,
|
pub mesh: Handle<Mesh>,
|
||||||
pub material: Handle<StandardMaterial>,
|
pub material: Handle<StandardMaterial>,
|
||||||
@ -21,19 +21,6 @@ pub struct PbrBundle {
|
|||||||
pub computed_visibility: ComputedVisibility,
|
pub computed_visibility: ComputedVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PbrBundle {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
mesh: Default::default(),
|
|
||||||
material: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
computed_visibility: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Component, Clone, Debug, Default)]
|
#[derive(Component, Clone, Debug, Default)]
|
||||||
pub struct CubemapVisibleEntities {
|
pub struct CubemapVisibleEntities {
|
||||||
data: [VisibleEntities; 6],
|
data: [VisibleEntities; 6],
|
||||||
|
@ -10,7 +10,7 @@ use bevy_render2::{
|
|||||||
};
|
};
|
||||||
use bevy_transform::components::{GlobalTransform, Transform};
|
use bevy_transform::components::{GlobalTransform, Transform};
|
||||||
|
|
||||||
#[derive(Bundle, Clone)]
|
#[derive(Bundle, Clone, Default)]
|
||||||
pub struct PipelinedSpriteBundle {
|
pub struct PipelinedSpriteBundle {
|
||||||
pub sprite: Sprite,
|
pub sprite: Sprite,
|
||||||
pub transform: Transform,
|
pub transform: Transform,
|
||||||
@ -22,22 +22,9 @@ pub struct PipelinedSpriteBundle {
|
|||||||
pub computed_visibility: ComputedVisibility,
|
pub computed_visibility: ComputedVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PipelinedSpriteBundle {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
sprite: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
texture: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
computed_visibility: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A Bundle of components for drawing a single sprite from a sprite sheet (also referred
|
/// A Bundle of components for drawing a single sprite from a sprite sheet (also referred
|
||||||
/// to as a `TextureAtlas`)
|
/// to as a `TextureAtlas`)
|
||||||
#[derive(Bundle, Clone)]
|
#[derive(Bundle, Clone, Default)]
|
||||||
pub struct PipelinedSpriteSheetBundle {
|
pub struct PipelinedSpriteSheetBundle {
|
||||||
/// The specific sprite from the texture atlas to be drawn
|
/// The specific sprite from the texture atlas to be drawn
|
||||||
pub sprite: TextureAtlasSprite,
|
pub sprite: TextureAtlasSprite,
|
||||||
@ -51,16 +38,3 @@ pub struct PipelinedSpriteSheetBundle {
|
|||||||
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
/// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering
|
||||||
pub computed_visibility: ComputedVisibility,
|
pub computed_visibility: ComputedVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PipelinedSpriteSheetBundle {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
sprite: Default::default(),
|
|
||||||
texture_atlas: Default::default(),
|
|
||||||
transform: Default::default(),
|
|
||||||
global_transform: Default::default(),
|
|
||||||
visibility: Default::default(),
|
|
||||||
computed_visibility: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user