-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lints drop_non_drop
and forget_non_drop
#8630
Conversation
r? @Manishearth (rust-highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 5cd711b has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fix typo fix typo in #8630 changelog: none
/// Checks for calls to `std::mem::drop` with a value that does not implement `Drop`. | ||
/// | ||
/// ### Why is this bad? | ||
/// Calling `std::mem::drop` is no different than dropping such a type. A different value may |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the wording of this could be improved. It looks like it was copied and pasted from the forget
lint and I think this description is confusing – yes std::mem::drop
is in fact no different than dropping it, what’s the problem?
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.
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 issues on Bevy site is tracked here bevyengine/bevy#4601
fixes #1897
changelog: Add lints
drop_non_drop
andforget_non_drop