1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#![feature(plugin)]
#![plugin(clippy)]
#![allow(dead_code)]
#![deny(new_without_default)]
struct Foo;
impl Foo {
fn new() -> Foo { Foo } //~ERROR: you should consider adding a `Default` implementation for `Foo`
}
struct Bar;
impl Bar {
fn new() -> Self { Bar } //~ERROR: you should consider adding a `Default` implementation for `Bar`
}
struct Ok;
impl Ok {
fn new() -> Self { Ok }
}
impl Default for Ok {
fn default() -> Self { Ok }
}
struct Params;
impl Params {
fn new(_: u32) -> Self { Params }
}
struct Generics<'a, T> {
foo: &'a bool,
bar: T,
}
impl<'c, V> Generics<'c, V> {
fn new<'b>() -> Generics<'b, V> { unimplemented!() } //~ERROR: you should consider adding a `Default` implementation for
}
fn main() {}