Skip to content

False positive: const_static_lifetime associated constants #2456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexheretic opened this issue Feb 12, 2018 · 2 comments
Closed

False positive: const_static_lifetime associated constants #2456

alexheretic opened this issue Feb 12, 2018 · 2 comments

Comments

@alexheretic
Copy link
Member

Clippy and rustc don't seem to agree when it comes to declaring static associated constant lifetimes.

trait Foo {
    const BAR: &'static str = "bar";
}

clippy

warning: Constants have by default a `'static` lifetime
 --> src/main.rs:5:17
  |
5 |     const BAR: &'static str = "bar";
  |                -^^^^^^^---- help: consider removing `'static`: `&str`

rustc

error[E0106]: missing lifetime specifier
 --> src/main.rs:5:16
  |
5 |     const BAR: &str = "bar";
  |                ^ expected lifetime parameter
@goodmanjonathan
Copy link
Contributor

This should have been fixed in #2443. Have you tried to update clippy recently?

@alexheretic
Copy link
Member Author

Thanks, this indeed does not occur on current master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants