We all know this case, the huge list of constants for compatibility with something else, with some constants unused but retained for completeness.
#[allow(unused)] suppresses messages for unused constants, but allowing all "unused" is too big a hammer for general use. "Unused" is supposedly all of unused_imports, unused_variables, unused_assignments, dead_code, unused_mut, unreachable_code, unused_must_use, unused_unsafe, path_statements, unused_attributes. Don't want to suppress all that for the entire impl section.
"Unused_variable" doesn't suppress warnings for constants. There doesn't seem to be an #[allow(unused_constants)].
There must be a proper way to do this. It's such a common case.
As a workaround, can you create an entire separate impl block for just the constants and nothing else? (Any given type can have multiple disjoint impl blocks.)
That's the workaround I'm using now, putting the constants in a separate impl block. But there must be a clean way to do this. It's such a common case.
That helps a little. I tried unused_variable, but that doesn't apply to constants.
Would unused_constant be a useful feature to request? It's a common use case. An unused variable is usually dead code, but an unused constant has legitimate uses.
And one more option is to change the name of each unused const to start with an underscore. (This means an extra step if you later end up using it, though.)