fix cast_lossless with macro call
This commit is contained in:
parent
f54275f20f
commit
af2a8478ba
4 changed files with 43 additions and 2 deletions
|
|
@ -25,7 +25,14 @@ 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, cast_op.span);
|
||||
let opt = snippet_opt(
|
||||
cx,
|
||||
if cast_op.span.from_expansion() {
|
||||
cast_op.span.source_callsite()
|
||||
} else {
|
||||
cast_op.span
|
||||
},
|
||||
);
|
||||
let sugg = opt.as_ref().map_or_else(
|
||||
|| {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue