Skip to content

Commit a86a570

Browse files
committed
replace lint with span_lint_and_then
1 parent 0c42e45 commit a86a570

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clippy_lints/src/casts/cast_possible_wrap.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
use clippy_utils::diagnostics::span_lint_and_then;
12
use rustc_hir::Expr;
2-
use rustc_lint::{LateContext, LintContext};
3+
use rustc_lint::LateContext;
34
use rustc_middle::ty::Ty;
45

56
use super::{utils, CAST_POSSIBLE_WRAP};
@@ -78,13 +79,11 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_from: Ty<'_>, ca
7879
),
7980
};
8081

81-
cx.struct_span_lint(CAST_POSSIBLE_WRAP, expr.span, message, |diag| {
82+
span_lint_and_then(cx, CAST_POSSIBLE_WRAP, expr.span, &message, |diag| {
8283
if let EmitState::LintOnPtrSize(16) = should_lint {
8384
diag
84-
.note("`usize` and `isize` may be as small as 16 bits on some platforms")
85-
.note("for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types")
86-
} else {
87-
diag
88-
}
85+
.note("`usize` and `isize` may be as small as 16 bits on some platforms")
86+
.note("for more information see https://doc.rust-lang.org/reference/types/numeric.html#machine-dependent-integer-types");
87+
};
8988
});
9089
}

0 commit comments

Comments
 (0)