]> git.lizzy.rs Git - rust.git/blob - tests/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs
Rollup merge of #105526 - Xiretza:iter-from-generator-derive, r=scottmcm
[rust.git] / tests / ui / single-use-lifetime / two-uses-in-inherent-method-argument-and-return.rs
1 // Test that we DO NOT warn for a lifetime used twice in an impl method and
2 // header.
3
4 #![deny(single_use_lifetimes)]
5 #![allow(dead_code)]
6 #![allow(unused_variables)]
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<'a>(&self, data: &'a u32) -> &'a u32{
14       data
15     }
16 }
17
18 fn main() { }