-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Trait functions cannot be const
#3841
Labels
C-bug
Category: Clippy is not doing the correct thing
Comments
That sounds like a bug, thanks! Could you provide an example that triggers the lint? |
@phansch Here's a simple example that actually has the error twice, once for the declared function, and one for the derived #![warn(clippy::missing_const_for_fn)]
#[derive(PartialEq, Eq)]
struct Point(isize, isize);
impl std::ops::Add for Point {
type Output = Self;
fn add(self, other: Self) -> Self {
Point(self.0 + other.0, self.1 + other.1)
}
}
fn main() {} Output when running
|
phansch
added a commit
to phansch/rust-clippy
that referenced
this issue
Mar 4, 2019
As reported in rust-lang#3841. Only fixes the part where it triggers on the `derive`.
bors
added a commit
that referenced
this issue
Mar 5, 2019
Fix two missing_const_for_fn false positives Fixes #3841 * Fixes false positive in external macros * Fixes false positive when implement trait methods
Manishearth
pushed a commit
that referenced
this issue
Apr 19, 2019
As reported in #3841. Only fixes the part where it triggers on the `derive`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When implementing a trait, clippy currently suggests making one of the functions
const
. That is currently not possible. At least for now, it seems like this should be an exception.The text was updated successfully, but these errors were encountered: