]> git.lizzy.rs Git - rust.git/blob - src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs
Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24
[rust.git] / src / test / ui / single-use-lifetime / one-use-in-inherent-method-argument.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 inherent method.
6
7 struct Foo<'f> {
8     data: &'f u32
9 }
10
11 impl<'f> Foo<'f> { //~ ERROR `'f` only used once
12     //~^ HELP elide the single-use lifetime
13     fn inherent_a<'a>(&self, data: &'a u32) { //~ ERROR `'a` only used once
14         //~^ HELP elide the single-use lifetime
15     }
16 }
17
18 fn main() { }