Skip to content

Commit 49ff42c

Browse files
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 rust-lang/rust-clippy#8987 ```rust for line in io::stdin().lines() { ... } ``` Co-authored-by: Jakob Hellermann <[email protected]>
1 parent 8ba6be1 commit 49ff42c

File tree

8 files changed

+20
-22
lines changed

8 files changed

+20
-22
lines changed

crates/bevy_ecs/macros/src/fetch.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
361361
}
362362
};
363363

364-
let tokens = TokenStream::from(quote! {
364+
TokenStream::from(quote! {
365365
#fetch_impl
366366

367367
#state_impl
@@ -421,8 +421,7 @@ pub fn derive_world_query_impl(ast: DeriveInput) -> TokenStream {
421421
#(q.#ignored_field_idents;)*
422422
}
423423
};
424-
});
425-
tokens
424+
})
426425
}
427426

428427
struct WorldQueryFieldInfo {

crates/bevy_ecs/src/query/state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ impl<Q: WorldQuery, F: WorldQuery> QueryState<Q, F> {
12301230

12311231
/// An error that occurs when retrieving a specific [`Entity`]'s query result.
12321232
// TODO: return the type_name as part of this error
1233-
#[derive(Debug, PartialEq, Clone, Copy)]
1233+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
12341234
pub enum QueryEntityError {
12351235
QueryDoesNotMatch(Entity),
12361236
NoSuchEntity(Entity),

crates/bevy_gltf/src/loader.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,7 @@ async fn load_buffers(
10271027
Err(()) => {
10281028
// TODO: Remove this and add dep
10291029
let buffer_path = asset_path.parent().unwrap().join(uri);
1030-
let buffer_bytes = load_context.read_asset_bytes(buffer_path).await?;
1031-
buffer_bytes
1030+
load_context.read_asset_bytes(buffer_path).await?
10321031
}
10331032
};
10341033
buffer_data.push(buffer_bytes);

crates/bevy_render/src/render_resource/pipeline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl VertexBufferLayout {
157157
}
158158

159159
/// Describes the fragment process in a render pipeline.
160-
#[derive(Clone, Debug, PartialEq)]
160+
#[derive(Clone, Debug, PartialEq, Eq)]
161161
pub struct FragmentState {
162162
/// The compiled shader module for this stage.
163163
pub shader: Handle<Shader>,

crates/bevy_ui/src/ui_node.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl Default for Style {
139139
}
140140

141141
/// How items are aligned according to the cross axis
142-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
142+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
143143
#[reflect_value(PartialEq, Serialize, Deserialize)]
144144
pub enum AlignItems {
145145
/// Items are aligned at the start
@@ -156,7 +156,7 @@ pub enum AlignItems {
156156
}
157157

158158
/// Works like [`AlignItems`] but applies only to a single item
159-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
159+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
160160
#[reflect_value(PartialEq, Serialize, Deserialize)]
161161
pub enum AlignSelf {
162162
/// Use the value of [`AlignItems`]
@@ -177,7 +177,7 @@ pub enum AlignSelf {
177177
/// Defines how each line is aligned within the flexbox.
178178
///
179179
/// It only applies if [`FlexWrap::Wrap`] is present and if there are multiple lines of items.
180-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
180+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
181181
#[reflect_value(PartialEq, Serialize, Deserialize)]
182182
pub enum AlignContent {
183183
/// Each line moves towards the start of the cross axis
@@ -200,7 +200,7 @@ pub enum AlignContent {
200200
/// Defines the text direction
201201
///
202202
/// For example English is written LTR (left-to-right) while Arabic is written RTL (right-to-left).
203-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
203+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
204204
#[reflect_value(PartialEq, Serialize, Deserialize)]
205205
pub enum Direction {
206206
/// Inherit from parent node
@@ -213,7 +213,7 @@ pub enum Direction {
213213
}
214214

215215
/// Whether to use Flexbox layout
216-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
216+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
217217
#[reflect_value(PartialEq, Serialize, Deserialize)]
218218
pub enum Display {
219219
/// Use flexbox
@@ -224,7 +224,7 @@ pub enum Display {
224224
}
225225

226226
/// Defines how flexbox items are ordered within a flexbox
227-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
227+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
228228
#[reflect_value(PartialEq, Serialize, Deserialize)]
229229
pub enum FlexDirection {
230230
/// Same way as text direction along the main axis
@@ -239,7 +239,7 @@ pub enum FlexDirection {
239239
}
240240

241241
/// Defines how items are aligned according to the main axis
242-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
242+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
243243
#[reflect_value(PartialEq, Serialize, Deserialize)]
244244
pub enum JustifyContent {
245245
/// Pushed towards the start
@@ -258,7 +258,7 @@ pub enum JustifyContent {
258258
}
259259

260260
/// Whether to show or hide overflowing items
261-
#[derive(Copy, Clone, PartialEq, Debug, Default, Reflect, Serialize, Deserialize)]
261+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Reflect, Serialize, Deserialize)]
262262
#[reflect_value(PartialEq, Serialize, Deserialize)]
263263
pub enum Overflow {
264264
/// Show overflowing items
@@ -269,7 +269,7 @@ pub enum Overflow {
269269
}
270270

271271
/// The strategy used to position this node
272-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
272+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
273273
#[reflect_value(PartialEq, Serialize, Deserialize)]
274274
pub enum PositionType {
275275
/// Relative to all other nodes with the [`PositionType::Relative`] value
@@ -282,7 +282,7 @@ pub enum PositionType {
282282
}
283283

284284
/// Defines if flexbox items appear on a single line or on multiple lines
285-
#[derive(Copy, Clone, PartialEq, Debug, Default, Serialize, Deserialize, Reflect)]
285+
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default, Serialize, Deserialize, Reflect)]
286286
#[reflect_value(PartialEq, Serialize, Deserialize)]
287287
pub enum FlexWrap {
288288
/// Single line, will overflow if needed

crates/bevy_window/src/window.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub enum WindowCommand {
267267
}
268268

269269
/// Defines the way a window is displayed.
270-
#[derive(Debug, Clone, Copy, PartialEq)]
270+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
271271
pub enum WindowMode {
272272
/// Creates a window that uses the given size.
273273
Windowed,

examples/app/custom_loop.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
//! lines from stdin and prints them from within the ecs.
33
44
use bevy::prelude::*;
5-
use std::{io, io::BufRead};
5+
use std::io;
66

77
struct Input(String);
88

99
fn my_runner(mut app: App) {
1010
println!("Type stuff into the console");
11-
for line in io::stdin().lock().lines() {
11+
for line in io::stdin().lines() {
1212
{
1313
let mut input = app.world.resource_mut::<Input>();
1414
input.0 = line.unwrap();

examples/reflection/reflection_types.rs

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

0 commit comments

Comments
 (0)