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