]> git.lizzy.rs Git - rust.git/blob - src/test/ui/single-use-lifetime/one-use-in-struct.rs
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
[rust.git] / src / test / ui / single-use-lifetime / one-use-in-struct.rs
1 // Test that we do not warn for named lifetimes in structs,
2 // even when they are only used once (since to not use a named
3 // lifetime is illegal!)
4 //
5 // check-pass
6
7 #![deny(single_use_lifetimes)]
8 #![allow(dead_code)]
9 #![allow(unused_variables)]
10
11 struct Foo<'f> {
12     data: &'f u32,
13 }
14
15 enum Bar<'f> {
16     Data(&'f u32),
17 }
18
19 trait Baz<'f> {}
20
21 // `Derive`d impls shouldn't trigger a warning, either (Issue #53738).
22 #[derive(Debug)]
23 struct Quux<'a> {
24     priors: &'a u32,
25 }
26
27 fn main() {}