mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
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
This commit is contained in:
parent
5e3ae770ac
commit
1ff4b98755
20 changed files with 20 additions and 20 deletions
|
@ -99,7 +99,7 @@ fn star(
|
|||
// We can now spawn the entities for the star and the camera
|
||||
commands.spawn((
|
||||
// We use a marker component to identify the custom colored meshes
|
||||
ColoredMesh2d::default(),
|
||||
ColoredMesh2d,
|
||||
// The `Handle<Mesh>` needs to be wrapped in a `Mesh2dHandle` to use 2d rendering instead of 3d
|
||||
Mesh2dHandle(meshes.add(star)),
|
||||
// This bundle's components are needed for something to be rendered
|
||||
|
|
|
@ -302,7 +302,7 @@ fn example_control_system(
|
|||
let randomize_colors = input.just_pressed(KeyCode::C);
|
||||
|
||||
for (material_handle, controls) in &controllable {
|
||||
let mut material = materials.get_mut(material_handle).unwrap();
|
||||
let material = materials.get_mut(material_handle).unwrap();
|
||||
material.base_color.set_a(state.alpha);
|
||||
|
||||
if controls.color && randomize_colors {
|
||||
|
|
|
@ -378,7 +378,7 @@ fn update_normal(
|
|||
return;
|
||||
}
|
||||
if let Some(normal) = normal.0.as_ref() {
|
||||
if let Some(mut image) = images.get_mut(normal) {
|
||||
if let Some(image) = images.get_mut(normal) {
|
||||
image.texture_descriptor.format = TextureFormat::Rgba8Unorm;
|
||||
*already_ran = true;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ fn asset_loaded(
|
|||
&& asset_server.get_load_state(cubemap.image_handle.clone_weak()) == LoadState::Loaded
|
||||
{
|
||||
info!("Swapping to {}...", CUBEMAPS[cubemap.index].0);
|
||||
let mut image = images.get_mut(&cubemap.image_handle).unwrap();
|
||||
let image = images.get_mut(&cubemap.image_handle).unwrap();
|
||||
// NOTE: PNGs do not have any metadata that could indicate they contain a cubemap texture,
|
||||
// so they appear as one texture. The following code reconfigures the texture as necessary.
|
||||
if image.texture_descriptor.array_layer_count() == 1 {
|
||||
|
|
|
@ -10,7 +10,7 @@ use rand::{thread_rng, Rng};
|
|||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (light_sway, movement))
|
||||
|
|
|
@ -430,7 +430,7 @@ fn update_color_grading_settings(
|
|||
mut selected_parameter: ResMut<SelectedParameter>,
|
||||
) {
|
||||
let method = tonemapping.single();
|
||||
let mut color_grading = per_method_settings.settings.get_mut(method).unwrap();
|
||||
let color_grading = per_method_settings.settings.get_mut(method).unwrap();
|
||||
let mut dt = time.delta_seconds() * 0.25;
|
||||
if keys.pressed(KeyCode::Left) {
|
||||
dt = -dt;
|
||||
|
|
|
@ -9,7 +9,7 @@ fn main() {
|
|||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
// Adds frame time diagnostics
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
// Adds a system that prints diagnostics to the console
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
// Any plugin can register diagnostics
|
||||
|
|
|
@ -334,7 +334,7 @@ fn contributors() -> Result<Contributors, LoadContributorsError> {
|
|||
|
||||
let contributors = BufReader::new(stdout)
|
||||
.lines()
|
||||
.filter_map(|x| x.ok())
|
||||
.map_while(|x| x.ok())
|
||||
.collect();
|
||||
|
||||
Ok(contributors)
|
||||
|
|
|
@ -37,7 +37,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.insert_resource(BevyCounter {
|
||||
count: 0,
|
||||
|
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
App::new()
|
||||
// Since this is also used as a benchmark, we want it to display performance data.
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||
primary_window: Some(Window {
|
||||
present_mode: PresentMode::AutoNoVsync,
|
||||
|
|
|
@ -30,7 +30,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, button_system);
|
||||
|
|
|
@ -28,7 +28,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (move_camera, print_mesh_count))
|
||||
|
|
|
@ -18,7 +18,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.insert_resource(Config {
|
||||
line_count: 50_000,
|
||||
fancy: false,
|
||||
|
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, setup);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (move_camera, print_light_count))
|
||||
|
|
|
@ -29,7 +29,7 @@ fn main() {
|
|||
))
|
||||
// Since this is also used as a benchmark, we want it to display performance data.
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||
primary_window: Some(Window {
|
||||
present_mode: PresentMode::AutoNoVsync,
|
||||
|
|
|
@ -18,7 +18,7 @@ fn main() {
|
|||
}),
|
||||
..default()
|
||||
}))
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_plugin(LogDiagnosticsPlugin::default())
|
||||
.add_systems(Startup, spawn)
|
||||
.add_systems(Update, update_text_bounds)
|
||||
|
|
|
@ -184,7 +184,7 @@ fn main() {
|
|||
App::new()
|
||||
.insert_resource(cfg)
|
||||
.add_plugins(MinimalPlugins)
|
||||
.add_plugin(TransformPlugin::default())
|
||||
.add_plugin(TransformPlugin)
|
||||
.add_systems(Startup, setup)
|
||||
// Updating transforms *must* be done before `CoreSet::PostUpdate`
|
||||
// or the hierarchy will momentarily be in an invalid state.
|
||||
|
|
|
@ -11,7 +11,7 @@ use bevy::{
|
|||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin::default())
|
||||
.add_plugin(FrameTimeDiagnosticsPlugin)
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, (text_update_system, text_color_system))
|
||||
.run();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
///! This example illustrates how to resize windows, and how to respond to a window being resized.
|
||||
//! This example illustrates how to resize windows, and how to respond to a window being resized.
|
||||
use bevy::{prelude::*, window::WindowResized};
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Reference in a new issue