Closed
Description
Summary
missing_const_for_fn
does not taike into account whether receiver is ~const Destruct
.
Lint Name
missing_const_for_fn
Reproducer
I tried this code:
#![warn(clippy::missing_const_for_fn)]
pub struct Identifier(String);
impl Identifier {
#[must_use = "If you don't use it, it will drop entire String"]
pub fn name(self) -> String {
self.0
}
}
I saw this happen:
warning: this could be a `const fn`
--> src/lib.rs:7:5
|
7 | / pub fn name(self) -> String {
8 | | self.0
9 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
I expected to the lint does not fire.
Version
rustc 1.70.0-nightly (1459b3128 2023-03-23)
binary: rustc
commit-hash: 1459b3128e288a85fcc4dd1fee7ada2cdcf28794
commit-date: 2023-03-23
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7
Additional Labels
No response