Skip to content

Merge pull request #47 from vpochapuis/main #222

Merge pull request #47 from vpochapuis/main

Merge pull request #47 from vpochapuis/main #222

GitHub Actions / clippy succeeded Mar 18, 2024 in 2s

clippy

132 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 132
Note 0
Help 0

Versions

  • rustc 1.76.0 (07dca489a 2024-02-04)
  • cargo 1.76.0 (c84b36747 2024-01-18)
  • clippy 0.1.76 (07dca48 2024-02-04)

Annotations

Check warning on line 63 in demos/src/moving_platform.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated function `make_system` is never used

warning: associated function `make_system` is never used
  --> demos/src/moving_platform.rs:63:8
   |
54 | impl MovingPlatform {
   | ------------------- associated function in this implementation
...
63 |     fn make_system<V: Component>(
   |        ^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 210 in demos/src/ui/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `setting_from_ui`

warning: unused variable: `setting_from_ui`
   --> demos/src/ui/mod.rs:210:5
    |
210 |     setting_from_ui: Res<DemoUiPhysicsBackendActive>,
    |     ^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_setting_from_ui`

Check warning on line 7 in demos/src/moving_platform.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `app`

warning: unused variable: `app`
 --> demos/src/moving_platform.rs:7:21
  |
7 |     fn build(&self, app: &mut App) {
  |                     ^^^ help: if this is intentional, prefix it with an underscore: `_app`
  |
  = note: `#[warn(unused_variables)]` on by default

Check warning on line 20 in demos/src/ui/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `make_update_plot_data_system`

warning: unused import: `make_update_plot_data_system`
  --> demos/src/ui/mod.rs:20:22
   |
20 | use self::plotting::{make_update_plot_data_system, plot_source_rolling_update};
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 6 in demos/src/levels_setup/for_2d_platformer.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused imports: `AdjustPrecision`, `Vector2`

warning: unused imports: `AdjustPrecision`, `Vector2`
 --> demos/src/levels_setup/for_2d_platformer.rs:6:12
  |
6 |     math::{AdjustPrecision, Vector2, Vector3},
  |            ^^^^^^^^^^^^^^^  ^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

Check warning on line 290 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> demos/src/bin/platformer_3d.rs:290:9
    |
173 | /         let command_altering_selectors = CommandAlteringSelectors::default()
174 | |             // By default Tnua uses a raycast, but this could be a problem if the character stands
175 | |             // just past the edge while part of its body is above the platform. To solve this, we
176 | |             // need to cast a shape - which is physics-engine specific. We set the shape using a
...   |
270 | |                 },
271 | |             );
    | |______________- unnecessary `let` binding
...
290 |           command_altering_selectors
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
    |
173 ~         
174 |         #[cfg(feature = "rapier3d")]
  ...
191 |         );
192 ~         CommandAlteringSelectors::default()
193 +             // By default Tnua uses a raycast, but this could be a problem if the character stands
194 +             // just past the edge while part of its body is above the platform. To solve this, we
195 +             // need to cast a shape - which is physics-engine specific. We set the shape using a
196 +             // component.
197 +             .with_combo(
198 +                 "Sensor Shape",
199 +                 1,
200 +                 &[
201 +                     ("no", |mut cmd| {
202 +                         #[cfg(feature = "rapier3d")]
203 +                         cmd.remove::<TnuaRapier3dSensorShape>();
204 +                         #[cfg(feature = "xpbd3d")]
205 +                         cmd.remove::<TnuaXpbd3dSensorShape>();
206 +                     }),
207 +                     ("flat (underfit)", |mut cmd| {
208 +                         #[cfg(feature = "rapier3d")]
209 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
210 +                             0.0, 0.49,
211 +                         )));
212 +                         #[cfg(feature = "xpbd3d")]
213 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.49)));
214 +                     }),
215 +                     ("flat (exact)", |mut cmd| {
216 +                         #[cfg(feature = "rapier3d")]
217 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
218 +                             0.0, 0.5,
219 +                         )));
220 +                         #[cfg(feature = "xpbd3d")]
221 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.5)));
222 +                     }),
223 +                     ("flat (overfit)", |mut cmd| {
224 +                         #[cfg(feature = "rapier3d")]
225 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
226 +                             0.0, 0.51,
227 +                         )));
228 +                         #[cfg(feature = "xpbd3d")]
229 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.51)));
230 +                     }),
231 +                     ("ball (underfit)", |mut cmd| {
232 +                         #[cfg(feature = "rapier3d")]
233 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.49)));
234 +                         #[cfg(feature = "xpbd3d")]
235 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.49)));
236 +                     }),
237 +                     ("ball (exact)", |mut cmd| {
238 +                         #[cfg(feature = "rapier3d")]
239 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.5)));
240 +                         #[cfg(feature = "xpbd3d")]
241 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.5)));
242 +                     }),
243 +                 ],
244 +             )
245 +             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
246 +                 // Tnua will automatically apply angular impulses/forces to fix the tilt and make
247 +                 // the character stand upward, but it is also possible to just let the physics
248 +                 // engine prevent rotation (other than around the Y axis, for turning)
249 +                 if lock_tilt {
250 +                     #[cfg(feature = "rapier3d")]
251 +                     cmd.insert(
252 +                         rapier::LockedAxes::ROTATION_LOCKED_X
253 +                             | rapier::LockedAxes::ROTATION_LOCKED_Z,
254 +                     );
255 +                     #[cfg(feature = "xpbd3d")]
256 +                     cmd.insert(xpbd::LockedAxes::new().lock_rotation_x().lock_rotation_z());
257 +                 } else {
258 +                     #[cfg(feature = "rapier3d")]
259 +                     cmd.insert(rapier::LockedAxes::empty());
260 +                     #[cfg(feature = "xpbd3d")]
261 +                     cmd.insert(xpbd::LockedAxes::new());
262 +                 }
263 +             })
264 +             .with_checkbox(
265 +                 "Phase Through Collision Groups",
266 +                 true,
267 +                 |mut cmd, use_collision_groups| {
268 +                     #[cfg(feature = "rapier3d")]
269 +                     if use_collision_groups {
270 +                         cmd.insert(CollisionGroups {
271 +                             memberships: Group::GROUP_2,
272 +                             filters: Group::GROUP_2,
273 +                         });
274 +                     } else {
275 +                         cmd.insert(CollisionGroups {
276 +                             memberships: Group::ALL,
277 +                             filters: Group::ALL,
278 +                         });
279 +                     }
280 +                     #[cfg(feature = "xpbd3d")]
281 +                     {
282 +                         let player_layers: LayerMask = if use_collision_groups {
283 +                             [LayerNames::Player].into()
284 +                         } else {
285 +                             [LayerNames::Player, LayerNames::PhaseThrough].into()
286 +                         };
287 +                         cmd.insert(CollisionLayers::new(player_layers, player_layers));
288 +                     }
289 +                 },
290 +             )
    |

Check warning on line 248 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:248:18
    |
248 |                 |mut cmd, use_collision_groups| {
    |                  ----^^^
    |                  |
    |                  help: remove this `mut`

Check warning on line 226 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:226:48
    |
226 |             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
    |                                                ----^^^
    |                                                |
    |                                                help: remove this `mut`

Check warning on line 218 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:218:39
    |
218 |                     ("ball (exact)", |mut cmd| {
    |                                       ----^^^
    |                                       |
    |                                       help: remove this `mut`

Check warning on line 212 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:212:42
    |
212 |                     ("ball (underfit)", |mut cmd| {
    |                                          ----^^^
    |                                          |
    |                                          help: remove this `mut`

Check warning on line 204 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:204:41
    |
204 |                     ("flat (overfit)", |mut cmd| {
    |                                         ----^^^
    |                                         |
    |                                         help: remove this `mut`

Check warning on line 196 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:196:39
    |
196 |                     ("flat (exact)", |mut cmd| {
    |                                       ----^^^
    |                                       |
    |                                       help: remove this `mut`

Check warning on line 188 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:188:42
    |
188 |                     ("flat (underfit)", |mut cmd| {
    |                                          ----^^^
    |                                          |
    |                                          help: remove this `mut`

Check warning on line 182 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variable does not need to be mutable

warning: variable does not need to be mutable
   --> demos/src/bin/platformer_3d.rs:182:29
    |
182 |                     ("no", |mut cmd| {
    |                             ----^^^
    |                             |
    |                             help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

Check warning on line 294 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:294:59
    |
294 |     cmd.insert(TnuaCrouchEnforcer::new(0.5 * Vector3::Y, |cmd| {
    |                                                           ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 248 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `use_collision_groups`

warning: unused variable: `use_collision_groups`
   --> demos/src/bin/platformer_3d.rs:248:27
    |
248 |                 |mut cmd, use_collision_groups| {
    |                           ^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_use_collision_groups`

Check warning on line 248 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:248:22
    |
248 |                 |mut cmd, use_collision_groups| {
    |                      ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 226 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:226:52
    |
226 |             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
    |                                                    ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 218 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:218:43
    |
218 |                     ("ball (exact)", |mut cmd| {
    |                                           ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 212 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:212:46
    |
212 |                     ("ball (underfit)", |mut cmd| {
    |                                              ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 204 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:204:45
    |
204 |                     ("flat (overfit)", |mut cmd| {
    |                                             ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 196 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:196:43
    |
196 |                     ("flat (exact)", |mut cmd| {
    |                                           ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 188 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:188:46
    |
188 |                     ("flat (underfit)", |mut cmd| {
    |                                              ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`

Check warning on line 182 in demos/src/bin/platformer_3d.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `cmd`

warning: unused variable: `cmd`
   --> demos/src/bin/platformer_3d.rs:182:33
    |
182 |                     ("no", |mut cmd| {
    |                                 ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 297 in demos/src/bin/shooter_like.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

returning the result of a `let` binding from a block

warning: returning the result of a `let` binding from a block
   --> demos/src/bin/shooter_like.rs:297:9
    |
180 | /         let command_altering_selectors = CommandAlteringSelectors::default()
181 | |             // By default Tnua uses a raycast, but this could be a problem if the character stands
182 | |             // just past the edge while part of its body is above the platform. To solve this, we
183 | |             // need to cast a shape - which is physics-engine specific. We set the shape using a
...   |
277 | |                 },
278 | |             );
    | |______________- unnecessary `let` binding
...
297 |           command_altering_selectors
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
    = note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
    |
180 ~         
181 |         #[cfg(feature = "rapier3d")]
  ...
198 |         );
199 ~         CommandAlteringSelectors::default()
200 +             // By default Tnua uses a raycast, but this could be a problem if the character stands
201 +             // just past the edge while part of its body is above the platform. To solve this, we
202 +             // need to cast a shape - which is physics-engine specific. We set the shape using a
203 +             // component.
204 +             .with_combo(
205 +                 "Sensor Shape",
206 +                 1,
207 +                 &[
208 +                     ("no", |mut cmd| {
209 +                         #[cfg(feature = "rapier3d")]
210 +                         cmd.remove::<TnuaRapier3dSensorShape>();
211 +                         #[cfg(feature = "xpbd3d")]
212 +                         cmd.remove::<TnuaXpbd3dSensorShape>();
213 +                     }),
214 +                     ("flat (underfit)", |mut cmd| {
215 +                         #[cfg(feature = "rapier3d")]
216 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
217 +                             0.0, 0.49,
218 +                         )));
219 +                         #[cfg(feature = "xpbd3d")]
220 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.49)));
221 +                     }),
222 +                     ("flat (exact)", |mut cmd| {
223 +                         #[cfg(feature = "rapier3d")]
224 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
225 +                             0.0, 0.5,
226 +                         )));
227 +                         #[cfg(feature = "xpbd3d")]
228 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.5)));
229 +                     }),
230 +                     ("flat (overfit)", |mut cmd| {
231 +                         #[cfg(feature = "rapier3d")]
232 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
233 +                             0.0, 0.51,
234 +                         )));
235 +                         #[cfg(feature = "xpbd3d")]
236 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.51)));
237 +                     }),
238 +                     ("ball (underfit)", |mut cmd| {
239 +                         #[cfg(feature = "rapier3d")]
240 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.49)));
241 +                         #[cfg(feature = "xpbd3d")]
242 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.49)));
243 +                     }),
244 +                     ("ball (exact)", |mut cmd| {
245 +                         #[cfg(feature = "rapier3d")]
246 +                         cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.5)));
247 +                         #[cfg(feature = "xpbd3d")]
248 +                         cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.5)));
249 +                     }),
250 +                 ],
251 +             )
252 +             .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
253 +                 // Tnua will automatically apply angular impulses/forces to fix the tilt and make
254 +                 // the character stand upward, but it is also possible to just let the physics
255 +                 // engine prevent rotation (other than around the Y axis, for turning)
256 +                 if lock_tilt {
257 +                     #[cfg(feature = "rapier3d")]
258 +                     cmd.insert(
259 +                         rapier::LockedAxes::ROTATION_LOCKED_X
260 +                             | rapier::LockedAxes::ROTATION_LOCKED_Z,
261 +                     );
262 +                     #[cfg(feature = "xpbd3d")]
263 +                     cmd.insert(xpbd::LockedAxes::new().lock_rotation_x().lock_rotation_z());
264 +                 } else {
265 +                     #[cfg(feature = "rapier3d")]
266 +                     cmd.insert(rapier::LockedAxes::empty());
267 +                     #[cfg(feature = "xpbd3d")]
268 +                     cmd.insert(xpbd::LockedAxes::new());
269 +                 }
270 +             })
271 +             .with_checkbox(
272 +                 "Phase Through Collision Groups",
273 +                 true,
274 +                 |mut cmd, use_collision_groups| {
275 +                     #[cfg(feature = "rapier3d")]
276 +                     if use_collision_groups {
277 +                         cmd.insert(CollisionGroups {
278 +                             memberships: Group::GROUP_2,
279 +                             filters: Group::GROUP_2,
280 +                         });
281 +                     } else {
282 +                         cmd.insert(CollisionGroups {
283 +                             memberships: Group::ALL,
284 +                             filters: Group::ALL,
285 +                         });
286 +                     }
287 +                     #[cfg(feature = "xpbd3d")]
288 +                     {
289 +                         let player_layers: LayerMask = if use_collision_groups {
290 +                             [LayerNames::Player].into()
291 +                         } else {
292 +                             [LayerNames::Player, LayerNames::PhaseThrough].into()
293 +                         };
294 +                         cmd.insert(CollisionLayers::new(player_layers, player_layers));
295 +                     }
296 +                 },
297 +             )
    |