const-gen icon indicating copy to clipboard operation
const-gen copied to clipboard

Generated code triggers clippy::redundant-static-lifetimes warning

Open desbma opened this issue 2 years ago • 4 comments

When using const_declaration! on Vec<u8>, the generated is made of const XXX: &'static [u8] lines, which triggers the clippy::redundant-static-lifetimes clippy lint.

I worked around this by stuffing #[allow(clippy::redundant_static_lifetimes)] lines in the generated code, but it is probably better to fix this at the source.

Thank you

desbma avatar Oct 17 '23 17:10 desbma

Fixed in 1.6.3

Eolu avatar Oct 31 '23 04:10 Eolu

Reopened due to https://github.com/Eolu/const-gen/issues/13

1.6.4 reverts this change. This will require more work than anticipated.

Eolu avatar Nov 01 '23 22:11 Eolu

Faced the same issue.

For future readers, here's what I came up with:

let const_declarations = [
    ...
]
.map(|s| "#[allow(clippy::redundant_static_lifetimes)]\n".to_string() + s.as_str())
.join("\n\n");

ShellCode33 avatar Feb 19 '24 21:02 ShellCode33