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.
11 #![feature(tool_lints)]
13 #![allow(unused, dead_code, clippy::needless_lifetimes, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)]
14 #![warn(clippy::extra_unused_lifetimes)]
21 fn used_lt<'a>(x: &'a u8) {
26 fn unused_lt<'a>(x: u8) {
30 fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
31 // 'a is useless here since it's not directly bound
34 fn lt_return<'a, 'b: 'a>(x: &'b u8) -> &'a u8 {
38 fn lt_return_only<'a>() -> &'a u8 {
42 fn unused_lt_blergh<'a>(x: Option<Box<Send+'a>>) {
48 fn x(&self, a: &'a u8);
51 impl<'a> Foo<'a> for u8 {
52 fn x(&self, a: &'a u8) {
63 // test for #489 (used lifetimes in bounds)
64 pub fn parse<'a, I: Iterator<Item=&'a str>>(_it: &mut I) {
67 pub fn parse2<'a, I>(_it: &mut I) where I: Iterator<Item=&'a str>{
74 fn self_ref_with_lifetime<'a>(&'a self) {}
75 fn explicit_self_with_lifetime<'a>(self: &'a Self) {}