2018-10-06 11:18:06 -05:00
|
|
|
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
|
2018-10-11 05:16:22 -05:00
|
|
|
|
2017-09-18 05:47:33 -05:00
|
|
|
|
2018-07-28 10:34:52 -05:00
|
|
|
#![allow(unused, dead_code, clippy::needless_lifetimes, clippy::needless_pass_by_value, clippy::trivially_copy_pass_by_ref)]
|
|
|
|
#![warn(clippy::extra_unused_lifetimes)]
|
2015-12-06 15:36:22 -06:00
|
|
|
|
|
|
|
fn empty() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn used_lt<'a>(x: &'a u8) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-08 07:58:07 -06:00
|
|
|
fn unused_lt<'a>(x: u8) {
|
2015-12-06 15:36:22 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-02-08 07:58:07 -06:00
|
|
|
fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
|
2015-12-06 15:36:22 -06:00
|
|
|
// 'a is useless here since it's not directly bound
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lt_return<'a, 'b: 'a>(x: &'b u8) -> &'a u8 {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn lt_return_only<'a>() -> &'a u8 {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn unused_lt_blergh<'a>(x: Option<Box<Send+'a>>) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
trait Foo<'a> {
|
|
|
|
fn x(&self, a: &'a u8);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Foo<'a> for u8 {
|
|
|
|
fn x(&self, a: &'a u8) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2015-12-10 10:44:12 -06:00
|
|
|
|
2016-05-17 16:25:20 -05:00
|
|
|
struct Bar;
|
|
|
|
|
|
|
|
impl Bar {
|
2017-02-08 07:58:07 -06:00
|
|
|
fn x<'a>(&self) {}
|
2016-05-17 16:25:20 -05:00
|
|
|
}
|
|
|
|
|
2015-12-10 10:44:12 -06:00
|
|
|
// test for #489 (used lifetimes in bounds)
|
|
|
|
pub fn parse<'a, I: Iterator<Item=&'a str>>(_it: &mut I) {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
pub fn parse2<'a, I>(_it: &mut I) where I: Iterator<Item=&'a str>{
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
2016-01-14 12:27:24 -06:00
|
|
|
struct X { x: u32 }
|
|
|
|
|
|
|
|
impl X {
|
|
|
|
fn self_ref_with_lifetime<'a>(&'a self) {}
|
|
|
|
fn explicit_self_with_lifetime<'a>(self: &'a Self) {}
|
|
|
|
}
|
|
|
|
|
2015-12-06 15:36:22 -06:00
|
|
|
fn main() {
|
|
|
|
|
|
|
|
}
|