]> git.lizzy.rs Git - rust.git/blob - tests/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs
Rollup merge of #106897 - estebank:issue-99430, r=davidtwco
[rust.git] / tests / ui / single-use-lifetime / one-use-in-inherent-impl-header.rs
1 #![deny(single_use_lifetimes)]
2 #![allow(dead_code)]
3 #![allow(unused_variables)]
4
5 // Test that we DO warn for a lifetime used only once in an impl, and that we
6 // don't warn for the anonymous lifetime.
7
8 struct Foo<'f> {
9     data: &'f u32
10 }
11
12 impl<'f> Foo<'f> { //~ ERROR `'f` only used once
13     fn inherent_a(&self) {
14     }
15 }
16
17 impl Foo<'_> {
18     fn inherent_b(&self) {}
19 }
20
21
22 fn main() { }