diff options
| author | Icxolu <10486322+Icxolu@users.noreply.github.com> | 2023-05-01 20:12:34 +0200 |
|---|---|---|
| committer | Icxolu <10486322+Icxolu@users.noreply.github.com> | 2023-05-01 20:12:34 +0200 |
| commit | 220a9db64215df07f730cd01322a0c8b658629cd (patch) | |
| tree | fe0aa475855f3cc34c250a88beff3d418dd740d2 | |
| parent | 032bc11fd482cc99fd3f85f053855b3e3e6ad18a (diff) | |
| download | rust-220a9db64215df07f730cd01322a0c8b658629cd.tar.gz rust-220a9db64215df07f730cd01322a0c8b658629cd.zip | |
fixed span and corrected test output
| -rw-r--r-- | clippy_lints/src/default_constructed_unit_struct.rs | 2 | ||||
| -rw-r--r-- | tests/ui/default_constructed_unit_struct.stderr | 24 |
2 files changed, 13 insertions, 13 deletions
diff --git a/clippy_lints/src/default_constructed_unit_struct.rs b/clippy_lints/src/default_constructed_unit_struct.rs index d518c8e7c56..d261cdd44a5 100644 --- a/clippy_lints/src/default_constructed_unit_struct.rs +++ b/clippy_lints/src/default_constructed_unit_struct.rs @@ -54,7 +54,7 @@ impl LateLintPass<'_> for DefaultConstructedUnitStruct { span_lint_and_sugg( cx, DEFAULT_CONSTRUCTED_UNIT_STRUCT, - qpath.last_segment_span(), + expr.span.with_lo(qpath.qself_span().hi()), "use of `default` to create a unit struct", "remove this call to `default`", String::new(), diff --git a/tests/ui/default_constructed_unit_struct.stderr b/tests/ui/default_constructed_unit_struct.stderr index 13439414f4a..952d4019644 100644 --- a/tests/ui/default_constructed_unit_struct.stderr +++ b/tests/ui/default_constructed_unit_struct.stderr @@ -1,28 +1,28 @@ -error: Use of `default` to create a unit struct. - --> $DIR/default_constructed_unit_struct.rs:39:33 +error: use of `default` to create a unit struct + --> $DIR/default_constructed_unit_struct.rs:39:31 | LL | inner: PhantomData::default(), - | ^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ help: remove this call to `default` | = note: `-D clippy::default-constructed-unit-struct` implied by `-D warnings` -error: Use of `default` to create a unit struct. - --> $DIR/default_constructed_unit_struct.rs:62:35 +error: use of `default` to create a unit struct + --> $DIR/default_constructed_unit_struct.rs:62:33 | LL | let _ = PhantomData::<usize>::default(); - | ^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ help: remove this call to `default` -error: Use of `default` to create a unit struct. - --> $DIR/default_constructed_unit_struct.rs:63:44 +error: use of `default` to create a unit struct + --> $DIR/default_constructed_unit_struct.rs:63:42 | LL | let _: PhantomData<i32> = PhantomData::default(); - | ^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ help: remove this call to `default` -error: Use of `default` to create a unit struct. - --> $DIR/default_constructed_unit_struct.rs:64:25 +error: use of `default` to create a unit struct + --> $DIR/default_constructed_unit_struct.rs:64:23 | LL | let _ = UnitStruct::default(); - | ^^^^^^^ help: remove this call to `default` + | ^^^^^^^^^^^ help: remove this call to `default` error: aborting due to 4 previous errors |
