fix new clippy lints (#5160)

# Objective

- Nightly clippy lints should be fixed before they get stable and break CI
  
## Solution

- fix new clippy lints
- ignore `significant_drop_in_scrutinee` since it isn't relevant in our loop https://github.com/rust-lang/rust-clippy/issues/8987
```rust
for line in io::stdin().lines() {
    ...
}
```

Co-authored-by: Jakob Hellermann <hellermann@sipgate.de>
This commit is contained in:
Jakob Hellermann 2022-07-01 13:41:23 +00:00
parent 8ba6be187d
commit 49ff42cc69
8 changed files with 20 additions and 22 deletions

View File

@ -361,7 +361,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
} }
}; };
let tokens = TokenStream::from(quote! { TokenStream::from(quote! {
#fetch_impl #fetch_impl
#state_impl #state_impl
@ -421,8 +421,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
#(q.#ignored_field_idents;)* #(q.#ignored_field_idents;)*
} }
}; };
}); })
tokens
} }
struct WorldQueryFieldInfo { struct WorldQueryFieldInfo {

View File

@ -1230,7 +1230,7 @@ impl<Q: WorldQuery, F: WorldQuery> QueryState<Q, F> {
/// An error that occurs when retrieving a specific [`Entity`]'s query result. /// An error that occurs when retrieving a specific [`Entity`]'s query result.
// TODO: return the type_name as part of this error // TODO: return the type_name as part of this error
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum QueryEntityError { pub enum QueryEntityError {
QueryDoesNotMatch(Entity), QueryDoesNotMatch(Entity),
NoSuchEntity(Entity), NoSuchEntity(Entity),

View File

@ -1027,8 +1027,7 @@ async fn load_buffers(
Err(()) => { Err(()) => {
// TODO: Remove this and add dep // TODO: Remove this and add dep
let buffer_path = asset_path.parent().unwrap().join(uri); let buffer_path = asset_path.parent().unwrap().join(uri);
let buffer_bytes = load_context.read_asset_bytes(buffer_path).await?; load_context.read_asset_bytes(buffer_path).await?
buffer_bytes
} }
}; };
buffer_data.push(buffer_bytes); buffer_data.push(buffer_bytes);

View File

@ -157,7 +157,7 @@ impl VertexBufferLayout {
} }
/// Describes the fragment process in a render pipeline. /// Describes the fragment process in a render pipeline.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct FragmentState { pub struct FragmentState {
/// The compiled shader module for this stage. /// The compiled shader module for this stage.
pub shader: Handle<Shader>, pub shader: Handle<Shader>,

View File

@ -139,7 +139,7 @@ impl Default for Style {
} }
/// How items are aligned according to the cross axis /// How items are aligned according to the cross axis
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum AlignItems { pub enum AlignItems {
/// Items are aligned at the start /// Items are aligned at the start
@ -156,7 +156,7 @@ pub enum AlignItems {
} }
/// Works like [`AlignItems`] but applies only to a single item /// Works like [`AlignItems`] but applies only to a single item
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum AlignSelf { pub enum AlignSelf {
/// Use the value of [`AlignItems`] /// Use the value of [`AlignItems`]
@ -177,7 +177,7 @@ pub enum AlignSelf {
/// Defines how each line is aligned within the flexbox. /// Defines how each line is aligned within the flexbox.
/// ///
/// It only applies if [`FlexWrap::Wrap`] is present and if there are multiple lines of items. /// It only applies if [`FlexWrap::Wrap`] is present and if there are multiple lines of items.
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum AlignContent { pub enum AlignContent {
/// Each line moves towards the start of the cross axis /// Each line moves towards the start of the cross axis
@ -200,7 +200,7 @@ pub enum AlignContent {
/// Defines the text direction /// Defines the text direction
/// ///
/// For example English is written LTR (left-to-right) while Arabic is written RTL (right-to-left). /// For example English is written LTR (left-to-right) while Arabic is written RTL (right-to-left).
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum Direction { pub enum Direction {
/// Inherit from parent node /// Inherit from parent node
@ -213,7 +213,7 @@ pub enum Direction {
} }
/// Whether to use Flexbox layout /// Whether to use Flexbox layout
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum Display { pub enum Display {
/// Use flexbox /// Use flexbox
@ -224,7 +224,7 @@ pub enum Display {
} }
/// Defines how flexbox items are ordered within a flexbox /// Defines how flexbox items are ordered within a flexbox
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum FlexDirection { pub enum FlexDirection {
/// Same way as text direction along the main axis /// Same way as text direction along the main axis
@ -239,7 +239,7 @@ pub enum FlexDirection {
} }
/// Defines how items are aligned according to the main axis /// Defines how items are aligned according to the main axis
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum JustifyContent { pub enum JustifyContent {
/// Pushed towards the start /// Pushed towards the start
@ -258,7 +258,7 @@ pub enum JustifyContent {
} }
/// Whether to show or hide overflowing items /// Whether to show or hide overflowing items
#[derive(Copy, Clone, PartialEq, Debug, Default, Reflect, Serialize, Deserialize)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Reflect, Serialize, Deserialize)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum Overflow { pub enum Overflow {
/// Show overflowing items /// Show overflowing items
@ -269,7 +269,7 @@ pub enum Overflow {
} }
/// The strategy used to position this node /// The strategy used to position this node
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum PositionType { pub enum PositionType {
/// Relative to all other nodes with the [`PositionType::Relative`] value /// Relative to all other nodes with the [`PositionType::Relative`] value
@ -282,7 +282,7 @@ pub enum PositionType {
} }
/// Defines if flexbox items appear on a single line or on multiple lines /// Defines if flexbox items appear on a single line or on multiple lines
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)] #[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum FlexWrap { pub enum FlexWrap {
/// Single line, will overflow if needed /// Single line, will overflow if needed

View File

@ -267,7 +267,7 @@ pub enum WindowCommand {
} }
/// Defines the way a window is displayed. /// Defines the way a window is displayed.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WindowMode { pub enum WindowMode {
/// Creates a window that uses the given size. /// Creates a window that uses the given size.
Windowed, Windowed,

View File

@ -2,13 +2,13 @@
//! lines from stdin and prints them from within the ecs. //! lines from stdin and prints them from within the ecs.
use bevy::prelude::*; use bevy::prelude::*;
use std::{io, io::BufRead}; use std::io;
struct Input(String); struct Input(String);
fn my_runner(mut app: App) { fn my_runner(mut app: App) {
println!("Type stuff into the console"); println!("Type stuff into the console");
for line in io::stdin().lock().lines() { for line in io::stdin().lines() {
{ {
let mut input = app.world.resource_mut::<Input>(); let mut input = app.world.resource_mut::<Input>();
input.0 = line.unwrap(); input.0 = line.unwrap();

View File

@ -36,7 +36,7 @@ pub struct C(usize);
/// These are exposed via methods like `Reflect::hash()`, `Reflect::partial_eq()`, and /// These are exposed via methods like `Reflect::hash()`, `Reflect::partial_eq()`, and
/// `Reflect::serialize()`. You can force these implementations to use the actual trait /// `Reflect::serialize()`. You can force these implementations to use the actual trait
/// implementations (instead of their defaults) like this: /// implementations (instead of their defaults) like this:
#[derive(Reflect, Hash, Serialize, PartialEq)] #[derive(Reflect, Hash, Serialize, PartialEq, Eq)]
#[reflect(Hash, Serialize, PartialEq)] #[reflect(Hash, Serialize, PartialEq)]
pub struct D { pub struct D {
x: usize, x: usize,
@ -47,7 +47,7 @@ pub struct D {
/// generally a good idea to implement (and reflect) the `PartialEq`, `Serialize`, and `Deserialize` /// generally a good idea to implement (and reflect) the `PartialEq`, `Serialize`, and `Deserialize`
/// traits on `reflect_value` types to ensure that these values behave as expected when nested /// traits on `reflect_value` types to ensure that these values behave as expected when nested
/// underneath Reflect-ed structs. /// underneath Reflect-ed structs.
#[derive(Reflect, Copy, Clone, PartialEq, Serialize, Deserialize)] #[derive(Reflect, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[reflect_value(PartialEq, Serialize, Deserialize)] #[reflect_value(PartialEq, Serialize, Deserialize)]
pub enum E { pub enum E {
X, X,