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