1 #![feature(tool_lints)]
7 #![warn(clippy::new_without_default, clippy::new_without_default_derive)]
12 pub fn new() -> Foo { Foo }
18 pub fn new() -> Self { Bar }
24 pub fn new() -> Self { Ok }
28 fn default() -> Self { Ok }
34 pub fn new(_: u32) -> Self { Params }
37 pub struct GenericsOk<T> {
41 impl<U> Default for GenericsOk<U> {
42 fn default() -> Self { unimplemented!(); }
45 impl<'c, V> GenericsOk<V> {
46 pub fn new() -> GenericsOk<V> { unimplemented!() }
53 impl<'b> Default for LtOk<'b> {
54 fn default() -> Self { unimplemented!(); }
58 pub fn new() -> LtOk<'c> { unimplemented!() }
66 pub fn new() -> LtKo<'c> { unimplemented!() }
67 // FIXME: that suggestion is missing lifetimes
73 fn new() -> Private { unimplemented!() } // We don't lint private items
79 pub const fn new() -> Const { Const } // const fns can't be implemented via Default
82 pub struct IgnoreGenericNew;
84 impl IgnoreGenericNew {
85 pub fn new<T>() -> Self { IgnoreGenericNew } // the derived Default does not make sense here as the result depends on T
88 pub trait TraitWithNew: Sized {