bevy/examples/3d
Lura 856b39d821
Apply Clippy lints regarding lazy evaluation and closures (#14015)
# Objective

- Lazily evaluate
[default](https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_or_default)~~/[or](https://rust-lang.github.io/rust-clippy/master/index.html#/or_fun_call)~~
values where it makes sense
  - ~~`unwrap_or(foo())` -> `unwrap_or_else(|| foo())`~~
  - `unwrap_or(Default::default())` -> `unwrap_or_default()`
  - etc.
- Avoid creating [redundant
closures](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_closure),
even for [method
calls](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_closure_for_method_calls)
  - `map(|something| something.into())` -> `map(Into:into)`

## Solution

- Apply Clippy lints:
-
~~[or_fun_call](https://rust-lang.github.io/rust-clippy/master/index.html#/or_fun_call)~~
-
[unwrap_or_default](https://rust-lang.github.io/rust-clippy/master/index.html#/unwrap_or_default)
-
[redundant_closure_for_method_calls](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_closure_for_method_calls)
([redundant
closures](https://rust-lang.github.io/rust-clippy/master/index.html#/redundant_closure)
is already enabled)

## Testing

- Tested on Windows 11 (`stable-x86_64-pc-windows-gnu`, 1.79.0)
- Bevy compiles without errors or warnings and examples seem to work as
intended
  - `cargo clippy` 
  - `cargo run -p ci -- compile` 

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-07-01 15:54:40 +00:00
..
3d_scene.rs Swapping back to using From<Color> for StandardMaterial in examples (#13566) 2024-05-29 13:50:28 +00:00
3d_shapes.rs Meshable extrusions (#13478) 2024-06-04 17:27:32 +00:00
3d_viewport_to_world.rs Swapping back to using From<Color> for StandardMaterial in examples (#13566) 2024-05-29 13:50:28 +00:00
animated_material.rs Add hue traits (#12399) 2024-03-22 00:36:46 +00:00
anisotropy.rs Omit font size where it closely matches the default in examples (#13952) 2024-06-20 21:01:28 +00:00
anti_aliasing.rs Implement subpixel morphological antialiasing, or SMAA. (#13423) 2024-06-04 17:07:34 +00:00
atmospheric_fog.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
auto_exposure.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
blend_modes.rs Omit font size where it closely matches the default in examples (#13952) 2024-06-20 21:01:28 +00:00
bloom_3d.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
clearcoat.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
color_grading.rs fix examples color_grading and mobile after BackgroundColor changes (#14033) 2024-06-26 12:54:23 +00:00
deferred_rendering.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
depth_of_field.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
fog.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
generate_custom_mesh.rs Fix a few "repeated word" typos (#13955) 2024-06-20 21:35:20 +00:00
irradiance_volumes.rs Apply Clippy lints regarding lazy evaluation and closures (#14015) 2024-07-01 15:54:40 +00:00
lighting.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
lightmaps.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
lines.rs Highlight dependency on shader files in examples (#13824) 2024-06-12 14:16:01 +00:00
load_gltf.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
load_gltf_extras.rs add handling of all missing gltf extras: scene, mesh & materials (#13453) 2024-06-03 13:16:38 +00:00
meshlet.rs revert reflections PR changes to the meshlet example (#13539) 2024-05-27 19:48:18 +00:00
motion_blur.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
orthographic.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
parallax_mapping.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
parenting.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
pbr.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
reflection_probes.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
render_to_texture.rs example render_to_texture: remove extra light (#13398) 2024-05-16 23:26:55 +00:00
shadow_biases.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
shadow_caster_receiver.rs Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
skybox.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
spherical_area_lights.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
split_screen.rs Make default behavior for BackgroundColor and BorderColor more intuitive (#14017) 2024-06-25 21:50:41 +00:00
spotlight.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
ssao.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
ssr.rs Highlight dependency on shader files in examples (#13824) 2024-06-12 14:16:01 +00:00
texture.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
tonemapping.rs Highlight dependency on shader files in examples (#13824) 2024-06-12 14:16:01 +00:00
transmission.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00
transparency_3d.rs Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
two_passes.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
update_gltf_scene.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
vertex_colors.rs Migrate from LegacyColor to bevy_color::Color (#12163) 2024-02-29 19:35:12 +00:00
visibility_range.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
volumetric_fog.rs glTF labels: add enum to avoid misspelling and keep up-to-date list documented (#13586) 2024-05-31 23:25:57 +00:00
wireframe.rs Updates default Text font size to 24px (#13603) 2024-05-31 16:41:27 +00:00