-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
$ rustc --version
rustc 1.25.0-nightly (0c6091fbd 2018-02-04)
$ cargo clippy --version
0.0.186Running cargo clippy over my project with #![cfg_attr(feature = "cargo-clippy", deny(clippy))] set results in the following errors:
error: Constants have by default a `'static` lifetime
const KEYWORD: &'static str = "whatever";
-^^^^^^^----- help: consider removing `'static`: `&str`
Doing so promptly results in
error[E0106]: missing lifetime specifier
const KEYWORD: &str = "whatever";
^ expected lifetime parameter
I presume that following Clippy's advice and running into a compiler-enforced hard error is a bug in Clippy?
In this particular case, the const in question is a trait associated constant:
trait Keyword {
const KEYWORD: &'static str;
}and the positions it is reporting for change are implementations of it:
impl Keyword for Whatever {
const KEYWORD: &'static str = "whatever";
}Removing any 'static marker, whether in the trait declaration or in implementations of it, causes E0106 to occur.
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy