2018-09-30 04:25:41 +00:00
|
|
|
// run-rustfix
|
2018-05-03 22:58:06 +00:00
|
|
|
|
|
|
|
// Test that we DO warn when lifetime name is not used at all.
|
|
|
|
|
2018-05-18 22:13:53 +00:00
|
|
|
#![deny(unused_lifetimes)]
|
2018-09-30 04:25:41 +00:00
|
|
|
#![allow(dead_code, unused_variables)]
|
2018-05-03 22:58:06 +00:00
|
|
|
|
2018-09-30 04:25:41 +00:00
|
|
|
fn september<'a>() {}
|
|
|
|
//~^ ERROR lifetime parameter `'a` never used
|
2018-10-28 06:40:56 +00:00
|
|
|
//~| HELP elide the unused lifetime
|
2018-05-03 22:58:06 +00:00
|
|
|
|
2018-09-30 04:25:41 +00:00
|
|
|
fn october<'a, 'b, T>(s: &'b T) -> &'b T {
|
|
|
|
//~^ ERROR lifetime parameter `'a` never used
|
2018-10-28 06:40:56 +00:00
|
|
|
//~| HELP elide the unused lifetime
|
2018-09-30 04:25:41 +00:00
|
|
|
s
|
|
|
|
}
|
|
|
|
|
2019-10-04 05:56:57 +00:00
|
|
|
fn november<'a, 'b>(s: &'a str) -> &'a str {
|
2018-09-30 04:25:41 +00:00
|
|
|
//~^ ERROR lifetime parameter `'b` never used
|
2018-10-28 06:40:56 +00:00
|
|
|
//~| HELP elide the unused lifetime
|
2018-09-30 04:25:41 +00:00
|
|
|
s
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|