Closed
Description
Summary
missing_const_for_fn
accidentally triggers for code generated by derives which you generally don't have any influence on.
Lint Name
missing_const_for_fn
Reproducer
I tried this code:
#![warn(clippy::missing_const_for_fn)]
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
#[repr(C)]
struct Header {
version: u16,
count: u16,
storage_offset: u16,
}
I saw this happen:
warning: this could be a `const fn`
--> src\layout\parser\font_resolving\name.rs:7:1
|
7 | #[repr(C)]
| ^
|
note: the lint level is defined here
--> src\lib.rs:6:5
|
6 | clippy::missing_const_for_fn,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
Weirdly the span is a bit different on the playground.
I expected to see this happen:
The lint shouldn't trigger. Also even if it would trigger, the span is somehow on the repr
and not on the derive.
Version
rustc 1.61.0 (fe5b13d68 2022-05-18)
binary: rustc
commit-hash: fe5b13d681f25ee6474be29d748c65adcd91f69e
commit-date: 2022-05-18
host: x86_64-pc-windows-msvc
release: 1.61.0
LLVM version: 14.0.0
Additional Labels
No response