Skip to content

Commit 220a9db

Browse files
committed
fixed span and corrected test output
1 parent 032bc11 commit 220a9db

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

clippy_lints/src/default_constructed_unit_struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl LateLintPass<'_> for DefaultConstructedUnitStruct {
5454
span_lint_and_sugg(
5555
cx,
5656
DEFAULT_CONSTRUCTED_UNIT_STRUCT,
57-
qpath.last_segment_span(),
57+
expr.span.with_lo(qpath.qself_span().hi()),
5858
"use of `default` to create a unit struct",
5959
"remove this call to `default`",
6060
String::new(),
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
error: Use of `default` to create a unit struct.
2-
--> $DIR/default_constructed_unit_struct.rs:39:33
1+
error: use of `default` to create a unit struct
2+
--> $DIR/default_constructed_unit_struct.rs:39:31
33
|
44
LL | inner: PhantomData::default(),
5-
| ^^^^^^^ help: remove this call to `default`
5+
| ^^^^^^^^^^^ help: remove this call to `default`
66
|
77
= note: `-D clippy::default-constructed-unit-struct` implied by `-D warnings`
88

9-
error: Use of `default` to create a unit struct.
10-
--> $DIR/default_constructed_unit_struct.rs:62:35
9+
error: use of `default` to create a unit struct
10+
--> $DIR/default_constructed_unit_struct.rs:62:33
1111
|
1212
LL | let _ = PhantomData::<usize>::default();
13-
| ^^^^^^^ help: remove this call to `default`
13+
| ^^^^^^^^^^^ help: remove this call to `default`
1414

15-
error: Use of `default` to create a unit struct.
16-
--> $DIR/default_constructed_unit_struct.rs:63:44
15+
error: use of `default` to create a unit struct
16+
--> $DIR/default_constructed_unit_struct.rs:63:42
1717
|
1818
LL | let _: PhantomData<i32> = PhantomData::default();
19-
| ^^^^^^^ help: remove this call to `default`
19+
| ^^^^^^^^^^^ help: remove this call to `default`
2020

21-
error: Use of `default` to create a unit struct.
22-
--> $DIR/default_constructed_unit_struct.rs:64:25
21+
error: use of `default` to create a unit struct
22+
--> $DIR/default_constructed_unit_struct.rs:64:23
2323
|
2424
LL | let _ = UnitStruct::default();
25-
| ^^^^^^^ help: remove this call to `default`
25+
| ^^^^^^^^^^^ help: remove this call to `default`
2626

2727
error: aborting due to 4 previous errors
2828

0 commit comments

Comments
 (0)