You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The statement <place>; causes a move from and drop of the value at place. For clarity of intent, this is better written as drop(<place>); to emphasize the destructor is what is being invoked.
> 65% of votes on the linked poll had intuition that this (var;) did not invoke the destructor, so this lint would definitely help avoid potentially misleading code. (rustc does already lint this as path_statements, so perhaps this should instead be an improvement to that lint. rust-lang/rust#48852 is a 2018 issue to remove the lint (which is currently incorrect) for path statements that invoke a destructor.
The text was updated successfully, but these errors were encountered:
As featured in this Twitter poll.
The statement
<place>;
causes a move from and drop of the value at place. For clarity of intent, this is better written asdrop(<place>);
to emphasize the destructor is what is being invoked.> 65% of votes on the linked poll had intuition that this (
var;
) did not invoke the destructor, so this lint would definitely help avoid potentially misleading code. (rustc does already lint this aspath_statements
, so perhaps this should instead be an improvement to that lint. rust-lang/rust#48852 is a 2018 issue to remove the lint (which is currently incorrect) for path statements that invoke a destructor.The text was updated successfully, but these errors were encountered: