更新 cast_lossless.rs

Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
This commit is contained in:
Chen Chen 2023-09-17 02:42:12 +08:00 committed by GitHub
parent af2a8478ba
commit 3cad623716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,14 +25,7 @@ pub(super) fn check(
// The suggestion is to use a function call, so if the original expression
// has parens on the outside, they are no longer needed.
let mut applicability = Applicability::MachineApplicable;
let opt = snippet_opt(
cx,
if cast_op.span.from_expansion() {
cast_op.span.source_callsite()
} else {
cast_op.span
},
);
let opt = snippet_opt(cx, cast_op.span.source_callsite());
let sugg = opt.as_ref().map_or_else(
|| {
applicability = Applicability::HasPlaceholders;