mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-06 06:57:42 +00:00
![]() Fix FP in inherent_to_string when the function has generic parameters Minimal example of the false positive: ```` struct G; impl G { fn to_string<const _N: usize>(&self) -> String { "G.to_string()".to_string() } } fn main() { let g = G; g.to_string::<1>(); } ```` Clippy emits an `inherent_to_string` warning, and suggests that we implement `Display` for `G` instead. However, this is not possible, since the generic parameter _N only exists in this function, not in `G` itself. This particular example uses const generics, which is where the issue is most likely to come up, but this PR skips the lint if the `to_string` function has any kind of generic parameters. changelog: Fix FP in `inherent_to_string` |
||
---|---|---|
.. | ||
auxiliary | ||
cargo | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
compile-test.rs | ||
dogfood.rs | ||
fmt.rs | ||
integration.rs | ||
missing-test-files.rs | ||
versioncheck.rs |