summaryrefslogtreecommitdiffstats
path: root/tests/ui/single-use-lifetime/one-use-in-inherent-method-return.rs
blob: c5938f4a10bbcb9bc6488d90c9054ce06cd1739f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![deny(single_use_lifetimes)]
#![allow(dead_code)]
#![allow(unused_variables)]

// Test that we DO NOT warn for a lifetime used just once in a return type,
// where that return type is in an inherent method.

struct Foo<'f> {
    data: &'f u32
}

impl<'f> Foo<'f> { //~ ERROR `'f` only used once
    fn inherent_a<'a>(&self) -> &'a u32 { // OK for 'a
        &22
    }
}

fn main() { }