Skip to content

Commit a870023

Browse files
committed
as_pointer_underscore: final touches
1 parent 2a1a2b1 commit a870023

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5193,7 +5193,6 @@ Released 2018-09-13
51935193
<!-- begin autogenerated links to lint list -->
51945194
[`absolute_paths`]: https://rust-lang.github.io/rust-clippy/master/index.html#absolute_paths
51955195
[`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
5196-
[`accidental_double_ref_into_flat_addr_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#accidental_double_ref_into_flat_addr_cast
51975196
[`alloc_instead_of_core`]: https://rust-lang.github.io/rust-clippy/master/index.html#alloc_instead_of_core
51985197
[`allow_attributes`]: https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes
51995198
[`allow_attributes_without_reason`]: https://rust-lang.github.io/rust-clippy/master/index.html#allow_attributes_without_reason
@@ -5204,6 +5203,7 @@ Released 2018-09-13
52045203
[`arc_with_non_send_sync`]: https://rust-lang.github.io/rust-clippy/master/index.html#arc_with_non_send_sync
52055204
[`arithmetic_side_effects`]: https://rust-lang.github.io/rust-clippy/master/index.html#arithmetic_side_effects
52065205
[`as_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions
5206+
[`as_pointer_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_pointer_underscore
52075207
[`as_ptr_cast_mut`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_ptr_cast_mut
52085208
[`as_underscore`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_underscore
52095209
[`assertions_on_constants`]: https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants

clippy_lints/src/casts/as_pointer_underscore.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@ pub fn check<'tcx>(cx: &LateContext<'tcx>, ty_into: Ty<'_>, cast_to_hir: &'tcx r
66
if let rustc_hir::TyKind::Ptr(rustc_hir::MutTy { ty, .. }) = cast_to_hir.kind
77
&& matches!(ty.kind, rustc_hir::TyKind::Infer)
88
{
9-
clippy_utils::diagnostics::span_lint_and_then(
9+
clippy_utils::diagnostics::span_lint_and_sugg(
1010
cx,
1111
super::AS_POINTER_UNDERSCORE,
1212
cast_to_hir.span,
1313
"using inferred pointer cast",
14-
|diag| {
15-
diag.span_suggestion(
16-
cast_to_hir.span,
17-
"use explicit type",
18-
ty_into,
19-
Applicability::MachineApplicable,
20-
);
21-
},
14+
"use explicit type",
15+
ty_into.to_string(),
16+
Applicability::MachineApplicable,
2217
);
2318
}
2419
}

0 commit comments

Comments
 (0)