about summary refs log tree commit diff
path: root/tests/ui/single-use-lifetime/issue-117965.rs
blob: 5eb2a03e13da48fc8a552c07ad07a1c9b97ecca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#![deny(single_use_lifetimes)]

pub enum Data<'a> {
    Borrowed(&'a str),
    Owned(String),
}

impl<'a> Data<'a> {
    pub fn get<'b: 'a>(&'b self) -> &'a str {
        //~^ ERROR lifetime parameter `'b` only used once
        match &self {
            Self::Borrowed(val) => val,
            Self::Owned(val) => &val,
        }
    }
}

fn main() {}