1 use clippy_utils::diagnostics::span_lint;
2 use clippy_utils::{is_expr_path_def_path, paths, ty::is_uninit_value_valid_for_ty};
3 use if_chain::if_chain;
5 use rustc_lint::LateContext;
7 use super::UNINIT_ASSUMED_INIT;
9 /// lint for `MaybeUninit::uninit().assume_init()` (we already have the latter)
10 pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
12 if let hir::ExprKind::Call(callee, args) = recv.kind;
14 if is_expr_path_def_path(cx, callee, &paths::MEM_MAYBEUNINIT_UNINIT);
15 if !is_uninit_value_valid_for_ty(cx, cx.typeck_results().expr_ty_adjusted(expr));
21 "this call for this type may be undefined behavior"