accidentally cause an ICE by putting the TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS handling after the match
The reason I did this in the first place was to try and figure out why I don't see my expected 7 error messages
This commit is contained in:
parent
7061b1c093
commit
b4ecee9ede
1 changed files with 19 additions and 15 deletions
|
|
@ -626,21 +626,25 @@ impl<'tcx> LateLintPass<'tcx> for Transmute {
|
|||
);
|
||||
}
|
||||
},
|
||||
(_, _) if can_be_expressed_as_pointer_cast(cx, e, from_ty, to_ty) => {
|
||||
span_lint(
|
||||
cx,
|
||||
TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
|
||||
e.span,
|
||||
&format!(
|
||||
"transmute from `{}` to `{}` which could be expressed as a pointer cast instead",
|
||||
from_ty,
|
||||
to_ty
|
||||
)
|
||||
);
|
||||
},
|
||||
_ => {
|
||||
return
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
if can_be_expressed_as_pointer_cast(cx, e, from_ty, to_ty) {
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
|
||||
e.span,
|
||||
&format!(
|
||||
"transmute from `{}` to `{}` which could be expressed as a pointer cast instead",
|
||||
from_ty,
|
||||
to_ty
|
||||
),
|
||||
|diag| {
|
||||
if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) {
|
||||
let sugg = format!("{} as {}", arg, to_ty);
|
||||
diag.span_suggestion(e.span, "try", sugg, Applicability::Unspecified);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue