1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
13 clippy::needless_lifetimes,
14 clippy::needless_pass_by_value,
15 clippy::trivially_copy_pass_by_ref
17 #![warn(clippy::extra_unused_lifetimes)]
21 fn used_lt<'a>(x: &'a u8) {}
23 fn unused_lt<'a>(x: u8) {}
25 fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
26 // 'a is useless here since it's not directly bound
29 fn lt_return<'a, 'b: 'a>(x: &'b u8) -> &'a u8 {
33 fn lt_return_only<'a>() -> &'a u8 {
37 fn unused_lt_blergh<'a>(x: Option<Box<Send + 'a>>) {}
40 fn x(&self, a: &'a u8);
43 impl<'a> Foo<'a> for u8 {
44 fn x(&self, a: &'a u8) {}
53 // test for #489 (used lifetimes in bounds)
54 pub fn parse<'a, I: Iterator<Item = &'a str>>(_it: &mut I) {
57 pub fn parse2<'a, I>(_it: &mut I)
59 I: Iterator<Item = &'a str>,
69 fn self_ref_with_lifetime<'a>(&'a self) {}
70 fn explicit_self_with_lifetime<'a>(self: &'a Self) {}