Skip to content

Commit 7a0fb90

Browse files
committed
Tweak output for 'add line' suggestion
1 parent 6b95029 commit 7a0fb90

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

tests/ui/crashes/ice-6252.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ LL | _n: PhantomData,
66
|
77
help: consider importing one of these items
88
|
9-
LL | use core::marker::PhantomData;
9+
LL + use core::marker::PhantomData;
10+
LL | trait TypeVal<T> {
1011
|
11-
LL | use serde::__private::PhantomData;
12+
LL + use serde::__private::PhantomData;
13+
LL | trait TypeVal<T> {
1214
|
13-
LL | use std::marker::PhantomData;
15+
LL + use std::marker::PhantomData;
16+
LL | trait TypeVal<T> {
1417
|
1518

1619
error[E0412]: cannot find type `VAL` in this scope

tests/ui/derivable_impls.stderr

+16-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ LL | | }
1414
= help: remove the manual implementation...
1515
help: ...and instead derive it
1616
|
17-
LL | #[derive(Default)]
17+
LL + #[derive(Default)]
18+
LL | struct FooDefault<'a> {
1819
|
1920

2021
error: this `impl` can be derived
@@ -30,7 +31,8 @@ LL | | }
3031
= help: remove the manual implementation...
3132
help: ...and instead derive it
3233
|
33-
LL | #[derive(Default)]
34+
LL + #[derive(Default)]
35+
LL | struct TupleDefault(bool, i32, u64);
3436
|
3537

3638
error: this `impl` can be derived
@@ -46,7 +48,8 @@ LL | | }
4648
= help: remove the manual implementation...
4749
help: ...and instead derive it
4850
|
49-
LL | #[derive(Default)]
51+
LL + #[derive(Default)]
52+
LL | struct StrDefault<'a>(&'a str);
5053
|
5154

5255
error: this `impl` can be derived
@@ -62,7 +65,8 @@ LL | | }
6265
= help: remove the manual implementation...
6366
help: ...and instead derive it
6467
|
65-
LL | #[derive(Default)]
68+
LL + #[derive(Default)]
69+
LL | struct Y(u32);
6670
|
6771

6872
error: this `impl` can be derived
@@ -78,7 +82,8 @@ LL | | }
7882
= help: remove the manual implementation...
7983
help: ...and instead derive it
8084
|
81-
LL | #[derive(Default)]
85+
LL + #[derive(Default)]
86+
LL | struct WithoutSelfCurly {
8287
|
8388

8489
error: this `impl` can be derived
@@ -94,7 +99,8 @@ LL | | }
9499
= help: remove the manual implementation...
95100
help: ...and instead derive it
96101
|
97-
LL | #[derive(Default)]
102+
LL + #[derive(Default)]
103+
LL | struct WithoutSelfParan(bool);
98104
|
99105

100106
error: this `impl` can be derived
@@ -110,7 +116,8 @@ LL | | }
110116
= help: remove the manual implementation...
111117
help: ...and instead derive it
112118
|
113-
LL | #[derive(Default)]
119+
LL + #[derive(Default)]
120+
LL | pub struct RepeatDefault1 {
114121
|
115122

116123
error: this `impl` can be derived
@@ -126,7 +133,8 @@ LL | | }
126133
= help: remove the manual implementation...
127134
help: ...and instead derive it...
128135
|
129-
LL | #[derive(Default)]
136+
LL + #[derive(Default)]
137+
LL | pub enum SimpleEnum {
130138
|
131139
help: ...and mark the default variant
132140
|

tests/ui/new_without_default.stderr

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LL + fn default() -> Self {
1414
LL + Self::new()
1515
LL + }
1616
LL + }
17+
LL | impl Foo {
1718
|
1819

1920
error: you should consider adding a `Default` implementation for `Bar`
@@ -31,6 +32,7 @@ LL + fn default() -> Self {
3132
LL + Self::new()
3233
LL + }
3334
LL + }
35+
LL | impl Bar {
3436
|
3537

3638
error: you should consider adding a `Default` implementation for `LtKo<'c>`
@@ -48,6 +50,7 @@ LL + fn default() -> Self {
4850
LL + Self::new()
4951
LL + }
5052
LL + }
53+
LL | impl<'c> LtKo<'c> {
5154
|
5255

5356
error: you should consider adding a `Default` implementation for `NewNotEqualToDerive`
@@ -65,6 +68,7 @@ LL + fn default() -> Self {
6568
LL + Self::new()
6669
LL + }
6770
LL + }
71+
LL | impl NewNotEqualToDerive {
6872
|
6973

7074
error: you should consider adding a `Default` implementation for `FooGenerics<T>`
@@ -82,6 +86,7 @@ LL + fn default() -> Self {
8286
LL + Self::new()
8387
LL + }
8488
LL + }
89+
LL | impl<T> FooGenerics<T> {
8590
|
8691

8792
error: you should consider adding a `Default` implementation for `BarGenerics<T>`
@@ -99,6 +104,7 @@ LL + fn default() -> Self {
99104
LL + Self::new()
100105
LL + }
101106
LL + }
107+
LL | impl<T: Copy> BarGenerics<T> {
102108
|
103109

104110
error: you should consider adding a `Default` implementation for `Foo<T>`

0 commit comments

Comments
 (0)