This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ pub struct Point {
182
182
pub y : f32 ,
183
183
}
184
184
185
- impl Default for Point {
185
+ impl Default for Point { //~ WARN
186
186
fn default ( ) -> Self { //~ ERROR function cannot return without recursing
187
187
Point {
188
188
x : Default :: default ( ) ,
Original file line number Diff line number Diff line change @@ -197,5 +197,23 @@ LL | ..Default::default()
197
197
|
198
198
= help: a `loop` may express intention better if this is on purpose
199
199
200
- error: aborting due to 18 previous errors
200
+ warning: `impl Default` that could be derived
201
+ --> $DIR/lint-unconditional-recursion.rs:185:1
202
+ |
203
+ LL | / impl Default for Point {
204
+ LL | | fn default() -> Self {
205
+ LL | | Point {
206
+ LL | | x: Default::default(),
207
+ ... |
208
+ LL | | }
209
+ LL | | }
210
+ | |_^
211
+ |
212
+ = note: `#[warn(default_could_be_derived)]` on by default
213
+ help: you don't need to manually `impl Default`, you can derive it
214
+ |
215
+ LL ~ #[derive(Default)] pub struct Point {
216
+ |
217
+
218
+ error: aborting due to 18 previous errors; 1 warning emitted
201
219
You can’t perform that action at this time.
0 commit comments