Change:
I tried this code: I got this warning: However, there is no impl on the type, so the error message is misleading. It is true however that there is a destructor, as defined here: That being said, it's insiginificant for all underlying types (only destructor of and type in the ), so ideally the warning still wouldn't even show. : <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summaryBacktrace</summary<p</p</details<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
Well, even if the parameter of is , it still has a side-effect (deallocates memory). I don't think we need this special-casing. I do think the diagnostic is a bit misleading and should just say "has a destructor" or "has side-effects when dropped". Is there a more practical code example for why you'd want to suppress this error? The example you gave is a bit artificial, so it's a hard to motivate why we'd want to suppress this code since it really could be rewritten to be clearer.
claim

Discussion:
consider immediately dropping the value lint_non_binding_let_on_drop_type = <del> non-binding let on a type that implements `Drop` </del> <ins> non-binding let on a type that has a destructor </ins> lint_non_binding_let_on_sync_lock = non-binding let on a synchronization lock .label = this lock is not assigned to a binding and is immediately dropped

/// intent. pub LET_UNDERSCORE_DROP, Allow, <del> "non-binding let on a type that implements `Drop`" </del> <ins> "non-binding let on a type that has a destructor" </ins> } declare_lint! {

#![deny(let_underscore_drop)] fn main() { <del> let _ = foo(); //~ ERROR non-binding let on a type that implements `Drop` </del> <ins> let _ = foo(); //~ ERROR non-binding let on a type that has a destructor </ins> } async fn from_config(_: Config) {}

<del> error: non-binding let on a type that implements `Drop` </del> <ins> error: non-binding let on a type that has a destructor </ins> --> $DIR/issue-119696-err-on-fn.rs:5:5 | LL |     let _ = foo();

// Must destructure at least one field of `Foo` let Foo { field } = beverage; // boom <del> _ = field; //~ ERROR non-binding let on a type that implements `Drop` </del> <ins> _ = field; //~ ERROR non-binding let on a type that has a destructor </ins> <del> let _ = field; //~ ERROR non-binding let on a type that implements `Drop` </del> <ins> let _ = field; //~ ERROR non-binding let on a type that has a destructor </ins> }

<del> error: non-binding let on a type that implements `Drop` </del> <ins> error: non-binding let on a type that has a destructor </ins> --> $DIR/issue-119697-extra-let.rs:15:5 | LL |     _ = field;

LL |     drop(field); |     ~~~~~     + <del> error: non-binding let on a type that implements `Drop` </del> <ins> error: non-binding let on a type that has a destructor </ins> --> $DIR/issue-119697-extra-let.rs:17:5 | LL |     let _ = field;

} fn main() { <del> let _ = NontrivialDrop; //~WARNING non-binding let on a type that implements `Drop` </del> <ins> let _ = NontrivialDrop; //~WARNING non-binding let on a type that has a destructor </ins> let (_, _) = (NontrivialDrop, NontrivialDrop); // This should be ignored. }

<del> warning: non-binding let on a type that implements `Drop` </del> <ins> warning: non-binding let on a type that has a destructor </ins> --> $DIR/let_underscore_drop.rs:13:5 | LL |     let _ = NontrivialDrop;