Fine-tune camera scheduling in the shooter-like demo #239
clippy
122 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 122 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.77.2 (25ef9e3d8 2024-04-09)
- cargo 1.77.2 (e52e36006 2024-03-26)
- clippy 0.1.77 (25ef9e3 2024-04-09)
Annotations
Check warning on line 353 in demos/src/bin/shooter_like.rs
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:353:9
|
236 | / let command_altering_selectors = CommandAlteringSelectors::default()
237 | | // By default Tnua uses a raycast, but this could be a problem if the character stands
238 | | // just past the edge while part of its body is above the platform. To solve this, we
239 | | // need to cast a shape - which is physics-engine specific. We set the shape using a
... |
333 | | },
334 | | );
| |______________- unnecessary `let` binding
...
353 | 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
|
236 ~
237 | #[cfg(feature = "rapier3d")]
...
254 | );
255 ~ CommandAlteringSelectors::default()
256 + // By default Tnua uses a raycast, but this could be a problem if the character stands
257 + // just past the edge while part of its body is above the platform. To solve this, we
258 + // need to cast a shape - which is physics-engine specific. We set the shape using a
259 + // component.
260 + .with_combo(
261 + "Sensor Shape",
262 + 1,
263 + &[
264 + ("no", |mut cmd| {
265 + #[cfg(feature = "rapier3d")]
266 + cmd.remove::<TnuaRapier3dSensorShape>();
267 + #[cfg(feature = "xpbd3d")]
268 + cmd.remove::<TnuaXpbd3dSensorShape>();
269 + }),
270 + ("flat (underfit)", |mut cmd| {
271 + #[cfg(feature = "rapier3d")]
272 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
273 + 0.0, 0.49,
274 + )));
275 + #[cfg(feature = "xpbd3d")]
276 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.49)));
277 + }),
278 + ("flat (exact)", |mut cmd| {
279 + #[cfg(feature = "rapier3d")]
280 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
281 + 0.0, 0.5,
282 + )));
283 + #[cfg(feature = "xpbd3d")]
284 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.5)));
285 + }),
286 + ("flat (overfit)", |mut cmd| {
287 + #[cfg(feature = "rapier3d")]
288 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
289 + 0.0, 0.51,
290 + )));
291 + #[cfg(feature = "xpbd3d")]
292 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.51)));
293 + }),
294 + ("ball (underfit)", |mut cmd| {
295 + #[cfg(feature = "rapier3d")]
296 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.49)));
297 + #[cfg(feature = "xpbd3d")]
298 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.49)));
299 + }),
300 + ("ball (exact)", |mut cmd| {
301 + #[cfg(feature = "rapier3d")]
302 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.5)));
303 + #[cfg(feature = "xpbd3d")]
304 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.5)));
305 + }),
306 + ],
307 + )
308 + .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
309 + // Tnua will automatically apply angular impulses/forces to fix the tilt and make
310 + // the character stand upward, but it is also possible to just let the physics
311 + // engine prevent rotation (other than around the Y axis, for turning)
312 + if lock_tilt {
313 + #[cfg(feature = "rapier3d")]
314 + cmd.insert(
315 + rapier::LockedAxes::ROTATION_LOCKED_X
316 + | rapier::LockedAxes::ROTATION_LOCKED_Z,
317 + );
318 + #[cfg(feature = "xpbd3d")]
319 + cmd.insert(xpbd::LockedAxes::new().lock_rotation_x().lock_rotation_z());
320 + } else {
321 + #[cfg(feature = "rapier3d")]
322 + cmd.insert(rapier::LockedAxes::empty());
323 + #[cfg(feature = "xpbd3d")]
324 + cmd.insert(xpbd::LockedAxes::new());
325 + }
326 + })
327 + .with_checkbox(
328 + "Phase Through Collision Groups",
329 + true,
330 + |mut cmd, use_collision_groups| {
331 + #[cfg(feature = "rapier3d")]
332 + if use_collision_groups {
333 + cmd.insert(CollisionGroups {
334 + memberships: Group::GROUP_2,
335 + filters: Group::GROUP_2,
336 + });
337 + } else {
338 + cmd.insert(CollisionGroups {
339 + memberships: Group::ALL,
340 + filters: Group::ALL,
341 + });
342 + }
343 + #[cfg(feature = "xpbd3d")]
344 + {
345 + let player_layers: LayerMask = if use_collision_groups {
346 + [LayerNames::Player].into()
347 + } else {
348 + [LayerNames::Player, LayerNames::PhaseThrough].into()
349 + };
350 + cmd.insert(CollisionLayers::new(player_layers, player_layers));
351 + }
352 + },
353 + )
|
Check warning on line 339 in demos/src/bin/platformer_3d.rs
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:339:9
|
222 | / let command_altering_selectors = CommandAlteringSelectors::default()
223 | | // By default Tnua uses a raycast, but this could be a problem if the character stands
224 | | // just past the edge while part of its body is above the platform. To solve this, we
225 | | // need to cast a shape - which is physics-engine specific. We set the shape using a
... |
319 | | },
320 | | );
| |______________- unnecessary `let` binding
...
339 | 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
|
222 ~
223 | #[cfg(feature = "rapier3d")]
...
240 | );
241 ~ CommandAlteringSelectors::default()
242 + // By default Tnua uses a raycast, but this could be a problem if the character stands
243 + // just past the edge while part of its body is above the platform. To solve this, we
244 + // need to cast a shape - which is physics-engine specific. We set the shape using a
245 + // component.
246 + .with_combo(
247 + "Sensor Shape",
248 + 1,
249 + &[
250 + ("no", |mut cmd| {
251 + #[cfg(feature = "rapier3d")]
252 + cmd.remove::<TnuaRapier3dSensorShape>();
253 + #[cfg(feature = "xpbd3d")]
254 + cmd.remove::<TnuaXpbd3dSensorShape>();
255 + }),
256 + ("flat (underfit)", |mut cmd| {
257 + #[cfg(feature = "rapier3d")]
258 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
259 + 0.0, 0.49,
260 + )));
261 + #[cfg(feature = "xpbd3d")]
262 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.49)));
263 + }),
264 + ("flat (exact)", |mut cmd| {
265 + #[cfg(feature = "rapier3d")]
266 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
267 + 0.0, 0.5,
268 + )));
269 + #[cfg(feature = "xpbd3d")]
270 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.5)));
271 + }),
272 + ("flat (overfit)", |mut cmd| {
273 + #[cfg(feature = "rapier3d")]
274 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::cylinder(
275 + 0.0, 0.51,
276 + )));
277 + #[cfg(feature = "xpbd3d")]
278 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::cylinder(0.0, 0.51)));
279 + }),
280 + ("ball (underfit)", |mut cmd| {
281 + #[cfg(feature = "rapier3d")]
282 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.49)));
283 + #[cfg(feature = "xpbd3d")]
284 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.49)));
285 + }),
286 + ("ball (exact)", |mut cmd| {
287 + #[cfg(feature = "rapier3d")]
288 + cmd.insert(TnuaRapier3dSensorShape(rapier::Collider::ball(0.5)));
289 + #[cfg(feature = "xpbd3d")]
290 + cmd.insert(TnuaXpbd3dSensorShape(xpbd::Collider::sphere(0.5)));
291 + }),
292 + ],
293 + )
294 + .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
295 + // Tnua will automatically apply angular impulses/forces to fix the tilt and make
296 + // the character stand upward, but it is also possible to just let the physics
297 + // engine prevent rotation (other than around the Y axis, for turning)
298 + if lock_tilt {
299 + #[cfg(feature = "rapier3d")]
300 + cmd.insert(
301 + rapier::LockedAxes::ROTATION_LOCKED_X
302 + | rapier::LockedAxes::ROTATION_LOCKED_Z,
303 + );
304 + #[cfg(feature = "xpbd3d")]
305 + cmd.insert(xpbd::LockedAxes::new().lock_rotation_x().lock_rotation_z());
306 + } else {
307 + #[cfg(feature = "rapier3d")]
308 + cmd.insert(rapier::LockedAxes::empty());
309 + #[cfg(feature = "xpbd3d")]
310 + cmd.insert(xpbd::LockedAxes::new());
311 + }
312 + })
313 + .with_checkbox(
314 + "Phase Through Collision Groups",
315 + true,
316 + |mut cmd, use_collision_groups| {
317 + #[cfg(feature = "rapier3d")]
318 + if use_collision_groups {
319 + cmd.insert(CollisionGroups {
320 + memberships: Group::GROUP_2,
321 + filters: Group::GROUP_2,
322 + });
323 + } else {
324 + cmd.insert(CollisionGroups {
325 + memberships: Group::ALL,
326 + filters: Group::ALL,
327 + });
328 + }
329 + #[cfg(feature = "xpbd3d")]
330 + {
331 + let player_layers: LayerMask = if use_collision_groups {
332 + [LayerNames::Player].into()
333 + } else {
334 + [LayerNames::Player, LayerNames::PhaseThrough].into()
335 + };
336 + cmd.insert(CollisionLayers::new(player_layers, player_layers));
337 + }
338 + },
339 + )
|
Check warning on line 315 in demos/src/bin/platformer_2d.rs
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_2d.rs:315:9
|
205 | / let command_altering_selectors = CommandAlteringSelectors::default()
206 | | // By default Tnua uses a raycast, but this could be a problem if the character stands
207 | | // just past the edge while part of its body is above the platform. To solve this, we
208 | | // need to cast a shape - which is physics-engine specific. We set the shape using a
... |
293 | | },
294 | | );
| |______________- unnecessary `let` binding
...
315 | 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
|
205 ~
206 | #[cfg(feature = "rapier2d")]
...
225 | );
226 ~ CommandAlteringSelectors::default()
227 + // By default Tnua uses a raycast, but this could be a problem if the character stands
228 + // just past the edge while part of its body is above the platform. To solve this, we
229 + // need to cast a shape - which is physics-engine specific. We set the shape using a
230 + // component.
231 + .with_combo(
232 + "Sensor Shape",
233 + 1,
234 + &[
235 + ("Point", |mut cmd| {
236 + #[cfg(feature = "rapier2d")]
237 + cmd.remove::<TnuaRapier2dSensorShape>();
238 + #[cfg(feature = "xpbd2d")]
239 + cmd.remove::<TnuaXpbd2dSensorShape>();
240 + }),
241 + ("Flat (underfit)", |mut cmd| {
242 + #[cfg(feature = "rapier2d")]
243 + cmd.insert(TnuaRapier2dSensorShape(rapier::Collider::cuboid(0.49, 0.0)));
244 + #[cfg(feature = "xpbd2d")]
245 + cmd.insert(TnuaXpbd2dSensorShape(xpbd::Collider::rectangle(0.99, 0.0)));
246 + }),
247 + ("Flat (exact)", |mut cmd| {
248 + #[cfg(feature = "rapier2d")]
249 + cmd.insert(TnuaRapier2dSensorShape(rapier::Collider::cuboid(0.5, 0.0)));
250 + #[cfg(feature = "xpbd2d")]
251 + cmd.insert(TnuaXpbd2dSensorShape(xpbd::Collider::rectangle(1.0, 0.0)));
252 + }),
253 + ("flat (overfit)", |mut cmd| {
254 + #[cfg(feature = "rapier2d")]
255 + cmd.insert(TnuaRapier2dSensorShape(rapier::Collider::cuboid(0.51, 0.0)));
256 + #[cfg(feature = "xpbd2d")]
257 + cmd.insert(TnuaXpbd2dSensorShape(xpbd::Collider::rectangle(1.01, 0.0)));
258 + }),
259 + ("Ball (underfit)", |mut cmd| {
260 + #[cfg(feature = "rapier2d")]
261 + cmd.insert(TnuaRapier2dSensorShape(rapier::Collider::ball(0.49)));
262 + #[cfg(feature = "xpbd2d")]
263 + cmd.insert(TnuaXpbd2dSensorShape(xpbd::Collider::circle(0.49)));
264 + }),
265 + ("Ball (exact)", |mut cmd| {
266 + #[cfg(feature = "rapier2d")]
267 + cmd.insert(TnuaRapier2dSensorShape(rapier::Collider::ball(0.5)));
268 + #[cfg(feature = "xpbd2d")]
269 + cmd.insert(TnuaXpbd2dSensorShape(xpbd::Collider::circle(0.5)));
270 + }),
271 + ],
272 + )
273 + .with_checkbox("Lock Tilt", false, |mut cmd, lock_tilt| {
274 + // Tnua will automatically apply angular impulses/forces to fix the tilt and make
275 + // the character stand upward, but it is also possible to just let the physics
276 + // engine prevent rotation (other than around the Y axis, for turning)
277 + if lock_tilt {
278 + #[cfg(feature = "rapier2d")]
279 + cmd.insert(rapier::LockedAxes::ROTATION_LOCKED);
280 + #[cfg(feature = "xpbd2d")]
281 + cmd.insert(xpbd::LockedAxes::new().lock_rotation());
282 + } else {
283 + #[cfg(feature = "rapier2d")]
284 + cmd.insert(rapier::LockedAxes::empty());
285 + #[cfg(feature = "xpbd2d")]
286 + cmd.insert(xpbd::LockedAxes::new());
287 + }
288 + })
289 + .with_checkbox(
290 + "Phase Through Collision Groups",
291 + true,
292 + |mut cmd, use_collision_groups| {
293 + #[cfg(feature = "rapier2d")]
294 + if use_collision_groups {
295 + cmd.insert(CollisionGroups {
296 + memberships: Group::GROUP_2,
297 + filters: Group::GROUP_2,
298 + });
299 + } else {
300 + cmd.insert(CollisionGroups {
301 + memberships: Group::ALL,
302 + filters: Group::ALL,
303 + });
304 + }
305 + #[cfg(feature = "xpbd2d")]
306 + {
307 + let player_layers: LayerMask = if use_collision_groups {
308 + [LayerNames::Player].into()
309 + } else {
310 + [LayerNames::Player, LayerNames::PhaseThrough].into()
311 + };
312 + cmd.insert(CollisionLayers::new(player_layers, player_layers));
313 + }
314 + },
315 + )
|
Check warning on line 271 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:271:18
|
271 | |mut cmd, use_collision_groups| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 252 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:252:49
|
252 | .with_checkbox("Lock Tilt", false, |mut cmd, lock_tilt| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 244 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:244:39
|
244 | ("Ball (exact)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 238 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:238:42
|
238 | ("Ball (underfit)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 232 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:232:41
|
232 | ("flat (overfit)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 226 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:226:39
|
226 | ("Flat (exact)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 220 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:220:42
|
220 | ("Flat (underfit)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 214 in demos/src/bin/platformer_2d.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/platformer_2d.rs:214:32
|
214 | ("Point", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
|
= note: `#[warn(unused_mut)]` on by default
Check warning on line 319 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:319:59
|
319 | cmd.insert(TnuaCrouchEnforcer::new(0.5 * Vector3::Y, |cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 271 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `use_collision_groups`
warning: unused variable: `use_collision_groups`
--> demos/src/bin/platformer_2d.rs:271:27
|
271 | |mut cmd, use_collision_groups| {
| ^^^^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_use_collision_groups`
Check warning on line 271 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:271:22
|
271 | |mut cmd, use_collision_groups| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 252 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:252:53
|
252 | .with_checkbox("Lock Tilt", false, |mut cmd, lock_tilt| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 244 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:244:43
|
244 | ("Ball (exact)", |mut cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 238 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:238:46
|
238 | ("Ball (underfit)", |mut cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 232 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:232:45
|
232 | ("flat (overfit)", |mut cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 226 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:226:43
|
226 | ("Flat (exact)", |mut cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 220 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:220:46
|
220 | ("Flat (underfit)", |mut cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
Check warning on line 214 in demos/src/bin/platformer_2d.rs
github-actions / clippy
unused variable: `cmd`
warning: unused variable: `cmd`
--> demos/src/bin/platformer_2d.rs:214:36
|
214 | ("Point", |mut cmd| {
| ^^^ help: if this is intentional, prefix it with an underscore: `_cmd`
|
= note: `#[warn(unused_variables)]` on by default
Check warning on line 311 in demos/src/bin/shooter_like.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/shooter_like.rs:311:18
|
311 | |mut cmd, use_collision_groups| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 289 in demos/src/bin/shooter_like.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/shooter_like.rs:289:48
|
289 | .with_checkbox("Lock Tilt", true, |mut cmd, lock_tilt| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 281 in demos/src/bin/shooter_like.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/shooter_like.rs:281:39
|
281 | ("ball (exact)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`
Check warning on line 275 in demos/src/bin/shooter_like.rs
github-actions / clippy
variable does not need to be mutable
warning: variable does not need to be mutable
--> demos/src/bin/shooter_like.rs:275:42
|
275 | ("ball (underfit)", |mut cmd| {
| ----^^^
| |
| help: remove this `mut`