Skip to content

Commit

Permalink
Solve clippy::forget-non-drop lint error
Browse files Browse the repository at this point in the history
We started to get a Clippy error in CI:

error: call to `std::mem::forget` with a value that does not implement `Drop`. Forgetting such a type is the same as dropping it
  --> crates/spawner/src/spawner.rs:19:10
   |
19 | #[derive(Bundle)]
   |          ^^^^^^
   |
   = note: `-D clippy::forget-non-drop` implied by `-D warnings`
note: argument has type `spawner::Spawn`
  --> crates/spawner/src/spawner.rs:19:10
   |
19 | #[derive(Bundle)]
   |          ^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#forget_non_drop
   = note: this error originates in the derive macro `Bundle` (in Nightly builds, run with -Z macro-backtrace for more info)

The failing lint was recently added in
rust-lang/rust-clippy#8630. Unfortunately, it is
not possible to disable linting of code generated by external macros
rust-lang/rust-clippy#407.

The issue was reported to Bevy team here
bevyengine/bevy#5166.
  • Loading branch information
Indy2222 committed Jul 1, 2022
1 parent 62228c7 commit f0fcd2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/spawner/src/draft.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::forget_non_drop)] // Needed because of #[derive(Bundle)]

//! This module implements a Bevy plugin for drafting new objects on the map.
//! An entity marked with a component [`Draft`] is automatically handled and
//! visualized by the plugin.
Expand Down
2 changes: 2 additions & 0 deletions crates/spawner/src/spawner.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::forget_non_drop)] // Needed because of #[derive(Bundle)]

use bevy::prelude::*;
use de_core::{
gconfig::GameConfig,
Expand Down

0 comments on commit f0fcd2d

Please sign in to comment.