-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Invalid transformation to const function with deref #14091
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
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Comments
another example from rustc // Regression test for #30104
//@ check-pass
#![allow(unused)]
use std::ops::{Deref, DerefMut};
fn box_two_field(v: &mut Box<(i32, i32)>) {
let _a = &mut v.0;
let _b = &mut v.1;
}
fn box_destructure(v: &mut Box<(i32, i32)>) {
let (ref mut _head, ref mut _tail) = **v;
}
struct Wrap<T>(T);
impl<T> Deref for Wrap<T> {
type Target = T;
fn deref(&self) -> &T {
&self.0
}
}
impl<T> DerefMut for Wrap<T> {
fn deref_mut(&mut self) -> &mut T {
&mut self.0
}
}
fn smart_two_field(v: &mut Wrap<(i32, i32)>) {
let _a = &mut v.0;
let _b = &mut v.1;
}
fn smart_destructure(v: &mut Wrap<(i32, i32)>) {
let (ref mut _head, ref mut _tail) = **v;
}
fn main() {}
|
We're seeing this false positive in a bunch of places in mozilla/neqo, e.g., in https://github.com/mozilla/neqo/blob/7005337d9bcf347d79f8cad28605f6c539083824/neqo-transport/src/connection/mod.rs#L198-L203 |
larseggert
added a commit
to larseggert/neqo
that referenced
this issue
Feb 24, 2025
Ans suppress some false positives, see rust-lang/rust-clippy#14091
martinthomson
pushed a commit
to mozilla/neqo
that referenced
this issue
Feb 24, 2025
Ans suppress some false positives, see rust-lang/rust-clippy#14091
@rustbot claim |
Should also be fixed in #14294. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
Version
Error output
Backtrace
The text was updated successfully, but these errors were encountered: