]> git.lizzy.rs Git - rust.git/blob - tests/ui/unused_lt.rs
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / unused_lt.rs
1 #![feature(tool_lints)]
2
3 #![allow(unused, dead_code, clippy::needless_lifetimes, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)]
4 #![warn(clippy::extra_unused_lifetimes)]
5
6 fn empty() {
7
8 }
9
10
11 fn used_lt<'a>(x: &'a u8) {
12
13 }
14
15
16 fn unused_lt<'a>(x: u8) {
17
18 }
19
20 fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
21     // 'a is useless here since it's not directly bound
22 }
23
24 fn lt_return<'a, 'b: 'a>(x: &'b u8) -> &'a u8 {
25     panic!()
26 }
27
28 fn lt_return_only<'a>() -> &'a u8 {
29     panic!()
30 }
31
32 fn unused_lt_blergh<'a>(x: Option<Box<Send+'a>>) {
33
34 }
35
36
37 trait Foo<'a> {
38     fn x(&self, a: &'a u8);
39 }
40
41 impl<'a> Foo<'a> for u8 {
42     fn x(&self, a: &'a u8) {
43
44     }
45 }
46
47 struct Bar;
48
49 impl Bar {
50     fn x<'a>(&self) {}
51 }
52
53 // test for #489 (used lifetimes in bounds)
54 pub fn parse<'a, I: Iterator<Item=&'a str>>(_it: &mut I) {
55     unimplemented!()
56 }
57 pub fn parse2<'a, I>(_it: &mut I) where I: Iterator<Item=&'a str>{
58     unimplemented!()
59 }
60
61 struct X { x: u32 }
62
63 impl X {
64     fn self_ref_with_lifetime<'a>(&'a self) {}
65     fn explicit_self_with_lifetime<'a>(self: &'a Self) {}
66 }
67
68 fn main() {
69
70 }