5 #![warn(new_without_default, new_without_default_derive)]
10 pub fn new() -> Foo { Foo }
16 pub fn new() -> Self { Bar }
22 pub fn new() -> Self { Ok }
26 fn default() -> Self { Ok }
32 pub fn new(_: u32) -> Self { Params }
35 pub struct GenericsOk<T> {
39 impl<U> Default for GenericsOk<U> {
40 fn default() -> Self { unimplemented!(); }
43 impl<'c, V> GenericsOk<V> {
44 pub fn new() -> GenericsOk<V> { unimplemented!() }
51 impl<'b> Default for LtOk<'b> {
52 fn default() -> Self { unimplemented!(); }
56 pub fn new() -> LtOk<'c> { unimplemented!() }
64 pub fn new() -> LtKo<'c> { unimplemented!() }
65 // FIXME: that suggestion is missing lifetimes
71 fn new() -> Private { unimplemented!() } // We don't lint private items
77 pub const fn new() -> Const { Const } // const fns can't be implemented via Default
80 pub struct IgnoreGenericNew;
82 impl IgnoreGenericNew {
83 pub fn new<T>() -> Self { IgnoreGenericNew } // the derived Default does not make sense here as the result depends on T
86 pub trait TraitWithNew: Sized {