diff options
| author | bors <bors@rust-lang.org> | 2021-02-21 16:10:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-21 16:10:03 +0000 |
| commit | 728f3976f0dc0efee8f686d7ec7ecf2d3e7d9d6d (patch) | |
| tree | 8c54216edcaf586f99f1993e688836bb96b14612 /src/test/codegen/src-hash-algorithm | |
| parent | 208e95781b7c12e85e912e76a0d2d3f41846e48e (diff) | |
| parent | 19a377510c3de9a7404f690d52a5de761ce2aafd (diff) | |
| download | rust-728f3976f0dc0efee8f686d7ec7ecf2d3e7d9d6d.tar.gz rust-728f3976f0dc0efee8f686d7ec7ecf2d3e7d9d6d.zip | |
Auto merge of #6771 - MortenLohne:master, r=flip1995
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`
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
