Skip to content
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

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Apr 4, 2022

fixes #1897

changelog: Add lints drop_non_drop and forget_non_drop

@rust-highfive
Copy link

r? @Manishearth

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 4, 2022
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 6, 2022

📌 Commit 5cd711b has been approved by Manishearth

@bors
Copy link
Contributor

bors commented Apr 6, 2022

⌛ Testing commit 5cd711b with merge 0d66404...

@bors
Copy link
Contributor

bors commented Apr 6, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 0d66404 to master...

@bors bors merged commit 0d66404 into rust-lang:master Apr 6, 2022
@andy-k andy-k mentioned this pull request Apr 9, 2022
bors added a commit that referenced this pull request Apr 11, 2022
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
Copy link
Contributor

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?

Indy2222 added a commit to DigitalExtinction/Game that referenced this pull request Jul 1, 2022
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.
Indy2222 added a commit to DigitalExtinction/Game that referenced this pull request Jul 1, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mem::forget on !Drop
5 participants