Skip to content

Commit 1ff4b98

Browse files
fix new clippy lints before they reach stable (#8700)
# Objective - fix clippy lints early to make sure CI doesn't break when they get promoted to stable - have a noise-free `clippy` experience for nightly users ## Solution - `cargo clippy --fix` - replace `filter_map(|x| x.ok())` with `map_while(|x| x.ok())` to fix potential infinite loop in case of IO error
1 parent 5e3ae77 commit 1ff4b98

20 files changed

+20
-20
lines changed

examples/2d/mesh2d_manual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn star(
9999
// We can now spawn the entities for the star and the camera
100100
commands.spawn((
101101
// We use a marker component to identify the custom colored meshes
102-
ColoredMesh2d::default(),
102+
ColoredMesh2d,
103103
// The `Handle<Mesh>` needs to be wrapped in a `Mesh2dHandle` to use 2d rendering instead of 3d
104104
Mesh2dHandle(meshes.add(star)),
105105
// This bundle's components are needed for something to be rendered

examples/3d/blend_modes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn example_control_system(
302302
let randomize_colors = input.just_pressed(KeyCode::C);
303303

304304
for (material_handle, controls) in &controllable {
305-
let mut material = materials.get_mut(material_handle).unwrap();
305+
let material = materials.get_mut(material_handle).unwrap();
306306
material.base_color.set_a(state.alpha);
307307

308308
if controls.color && randomize_colors {

examples/3d/parallax_mapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ fn update_normal(
378378
return;
379379
}
380380
if let Some(normal) = normal.0.as_ref() {
381-
if let Some(mut image) = images.get_mut(normal) {
381+
if let Some(image) = images.get_mut(normal) {
382382
image.texture_descriptor.format = TextureFormat::Rgba8Unorm;
383383
*already_ran = true;
384384
}

examples/3d/skybox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn asset_loaded(
145145
&& asset_server.get_load_state(cubemap.image_handle.clone_weak()) == LoadState::Loaded
146146
{
147147
info!("Swapping to {}...", CUBEMAPS[cubemap.index].0);
148-
let mut image = images.get_mut(&cubemap.image_handle).unwrap();
148+
let image = images.get_mut(&cubemap.image_handle).unwrap();
149149
// NOTE: PNGs do not have any metadata that could indicate they contain a cubemap texture,
150150
// so they appear as one texture. The following code reconfigures the texture as necessary.
151151
if image.texture_descriptor.array_layer_count() == 1 {

examples/3d/spotlight.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rand::{thread_rng, Rng};
1010
fn main() {
1111
App::new()
1212
.add_plugins(DefaultPlugins)
13-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
13+
.add_plugin(FrameTimeDiagnosticsPlugin)
1414
.add_plugin(LogDiagnosticsPlugin::default())
1515
.add_systems(Startup, setup)
1616
.add_systems(Update, (light_sway, movement))

examples/3d/tonemapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ fn update_color_grading_settings(
430430
mut selected_parameter: ResMut<SelectedParameter>,
431431
) {
432432
let method = tonemapping.single();
433-
let mut color_grading = per_method_settings.settings.get_mut(method).unwrap();
433+
let color_grading = per_method_settings.settings.get_mut(method).unwrap();
434434
let mut dt = time.delta_seconds() * 0.25;
435435
if keys.pressed(KeyCode::Left) {
436436
dt = -dt;

examples/diagnostics/log_diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() {
99
App::new()
1010
.add_plugins(DefaultPlugins)
1111
// Adds frame time diagnostics
12-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
12+
.add_plugin(FrameTimeDiagnosticsPlugin)
1313
// Adds a system that prints diagnostics to the console
1414
.add_plugin(LogDiagnosticsPlugin::default())
1515
// Any plugin can register diagnostics

examples/games/contributors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ fn contributors() -> Result<Contributors, LoadContributorsError> {
334334

335335
let contributors = BufReader::new(stdout)
336336
.lines()
337-
.filter_map(|x| x.ok())
337+
.map_while(|x| x.ok())
338338
.collect();
339339

340340
Ok(contributors)

examples/stress_tests/bevymark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
}),
3838
..default()
3939
}))
40-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
40+
.add_plugin(FrameTimeDiagnosticsPlugin)
4141
.add_plugin(LogDiagnosticsPlugin::default())
4242
.insert_resource(BevyCounter {
4343
count: 0,

examples/stress_tests/many_animated_sprites.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
App::new()
2222
// Since this is also used as a benchmark, we want it to display performance data.
2323
.add_plugin(LogDiagnosticsPlugin::default())
24-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
24+
.add_plugin(FrameTimeDiagnosticsPlugin)
2525
.add_plugins(DefaultPlugins.set(WindowPlugin {
2626
primary_window: Some(Window {
2727
present_mode: PresentMode::AutoNoVsync,

examples/stress_tests/many_buttons.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn main() {
3030
}),
3131
..default()
3232
}))
33-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
33+
.add_plugin(FrameTimeDiagnosticsPlugin)
3434
.add_plugin(LogDiagnosticsPlugin::default())
3535
.add_systems(Startup, setup)
3636
.add_systems(Update, button_system);

examples/stress_tests/many_cubes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn main() {
2828
}),
2929
..default()
3030
}))
31-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
31+
.add_plugin(FrameTimeDiagnosticsPlugin)
3232
.add_plugin(LogDiagnosticsPlugin::default())
3333
.add_systems(Startup, setup)
3434
.add_systems(Update, (move_camera, print_mesh_count))

examples/stress_tests/many_gizmos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
}),
1919
..default()
2020
}))
21-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
21+
.add_plugin(FrameTimeDiagnosticsPlugin)
2222
.insert_resource(Config {
2323
line_count: 50_000,
2424
fancy: false,

examples/stress_tests/many_glyphs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
}),
2222
..default()
2323
}))
24-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
24+
.add_plugin(FrameTimeDiagnosticsPlugin)
2525
.add_plugin(LogDiagnosticsPlugin::default())
2626
.add_systems(Startup, setup);
2727

examples/stress_tests/many_lights.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn main() {
2424
}),
2525
..default()
2626
}))
27-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
27+
.add_plugin(FrameTimeDiagnosticsPlugin)
2828
.add_plugin(LogDiagnosticsPlugin::default())
2929
.add_systems(Startup, setup)
3030
.add_systems(Update, (move_camera, print_light_count))

examples/stress_tests/many_sprites.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn main() {
2929
))
3030
// Since this is also used as a benchmark, we want it to display performance data.
3131
.add_plugin(LogDiagnosticsPlugin::default())
32-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
32+
.add_plugin(FrameTimeDiagnosticsPlugin)
3333
.add_plugins(DefaultPlugins.set(WindowPlugin {
3434
primary_window: Some(Window {
3535
present_mode: PresentMode::AutoNoVsync,

examples/stress_tests/text_pipeline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() {
1818
}),
1919
..default()
2020
}))
21-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
21+
.add_plugin(FrameTimeDiagnosticsPlugin)
2222
.add_plugin(LogDiagnosticsPlugin::default())
2323
.add_systems(Startup, spawn)
2424
.add_systems(Update, update_text_bounds)

examples/stress_tests/transform_hierarchy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn main() {
184184
App::new()
185185
.insert_resource(cfg)
186186
.add_plugins(MinimalPlugins)
187-
.add_plugin(TransformPlugin::default())
187+
.add_plugin(TransformPlugin)
188188
.add_systems(Startup, setup)
189189
// Updating transforms *must* be done before `CoreSet::PostUpdate`
190190
// or the hierarchy will momentarily be in an invalid state.

examples/ui/text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use bevy::{
1111
fn main() {
1212
App::new()
1313
.add_plugins(DefaultPlugins)
14-
.add_plugin(FrameTimeDiagnosticsPlugin::default())
14+
.add_plugin(FrameTimeDiagnosticsPlugin)
1515
.add_systems(Startup, setup)
1616
.add_systems(Update, (text_update_system, text_color_system))
1717
.run();

examples/window/window_resizing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///! This example illustrates how to resize windows, and how to respond to a window being resized.
1+
//! This example illustrates how to resize windows, and how to respond to a window being resized.
22
use bevy::{prelude::*, window::WindowResized};
33

44
fn main() {

0 commit comments

Comments
 (0)