2018-10-03 03:11:56 +00:00
|
|
|
#![feature(tool_lints)]
|
|
|
|
|
|
|
|
#![warn(clippy::new_ret_no_self)]
|
|
|
|
#![allow(dead_code, clippy::trivially_copy_pass_by_ref)]
|
|
|
|
|
|
|
|
fn main(){}
|
|
|
|
|
2018-10-03 10:55:31 +00:00
|
|
|
trait R {
|
|
|
|
type Item;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl R for S {
|
|
|
|
type Item = Self;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl S {
|
|
|
|
// should not trigger the lint
|
|
|
|
pub fn new() -> impl R<Item = Self> {
|
|
|
|
S
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S2;
|
|
|
|
|
|
|
|
impl R for S2 {
|
|
|
|
type Item = Self;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl S2 {
|
|
|
|
// should not trigger the lint
|
|
|
|
pub fn new(_: String) -> impl R<Item = Self> {
|
|
|
|
S2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct T;
|
|
|
|
|
|
|
|
impl T {
|
|
|
|
// should not trigger lint
|
|
|
|
pub fn new() -> Self {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
}
|
2018-10-03 03:11:56 +00:00
|
|
|
|
|
|
|
struct U;
|
|
|
|
|
|
|
|
impl U {
|
|
|
|
// should trigger lint
|
|
|
|
pub fn new() -> u32 {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct V;
|
|
|
|
|
|
|
|
impl V {
|
|
|
|
// should trigger lint
|
|
|
|
pub fn new(_: String) -> u32 {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
}
|