Skip to content

Commit 91ead2d

Browse files
declanvkblyxyas
andauthored
Prevent lint from trigger on proc-macro expanded code
Co-authored-by: Alejandra González <[email protected]>
1 parent effce8a commit 91ead2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clippy_lints/src/duration_to_float_precision_loss.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ fn check_cast<'tcx>(
212212
expr: &'tcx Expr<'_>,
213213
duration_expr: &'tcx Expr<'_>,
214214
) -> Option<LintApplicableSite> {
215-
if let ExprKind::MethodCall(method_path, method_receiver_expr, [], _) = duration_expr.kind {
215+
if let ExprKind::MethodCall(method_path, method_receiver_expr, [], _) = duration_expr.kind && !is_from_proc_macro!(cx, expr) {
216216
let method_receiver_ty = cx.typeck_results().expr_ty(method_receiver_expr);
217217
if is_type_diagnostic_item(cx, method_receiver_ty.peel_refs(), sym::Duration) {
218218
let cast_expr_ty = cx.typeck_results().expr_ty(expr);

0 commit comments

Comments
 (0)