-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
"path statement with no effect" issued even when drop
makes effect
#48852
Comments
drop
makes effectdrop
makes effect
Huh, I ran into this a couple weeks ago and typed up an issue, then decided at the last second to back out of it for some reason. Maybe I just figured that writing This lint is old, by the way. Older than older than old. (in Rust years, anyways) |
Writing |
Bumping this, as it's relevant to this recent Twitter poll. (See also rust-lang/rust-clippy#5205, rust-lang/rust-clippy#5206.) When the path statement invokes a move, this lint is plain wrong; as the value has been moved, the old binding is no longer usable. When this move invokes drop glue, this lint is even more wrong, because the drop glue is an observable effect, and removing the statement would change the semantics of the program. "Path statement with no effect is further potentially damaging, as it may lead the user to write I believe the correct behavior for this lint would be to suggest removing path statements that have no associated drop glue, but to suggest |
…-obk Lint path statements to suggest using drop when the type needs drop Fixes rust-lang#48852. With this change the current lint description doesn't really fit entirely anymore I think.
…-obk Lint path statements to suggest using drop when the type needs drop Fixes rust-lang#48852. With this change the current lint description doesn't really fit entirely anymore I think.
…-obk Lint path statements to suggest using drop when the type needs drop Fixes rust-lang#48852. With this change the current lint description doesn't really fit entirely anymore I think.
…-obk Lint path statements to suggest using drop when the type needs drop Fixes rust-lang#48852. With this change the current lint description doesn't really fit entirely anymore I think.
(playground link)
Removing the "no effect" line definitely has effect.
The warning may instead suggest to explicitly use
std::mem::drop
if that is what is needed.The text was updated successfully, but these errors were encountered: