This commit is contained in:
rsdy 2023-02-16 11:49:19 +00:00 committed by Pavan Kumar Sunkara
parent e707447a86
commit 5bb768177e
2 changed files with 4 additions and 2 deletions

View File

@ -3865,7 +3865,9 @@ fn check_methods<'tcx>(&self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
Some(("or", recv, [or_arg], or_span, _)) => {
or_then_unwrap::check(cx, expr, recv, or_arg, or_span);
},
// unnecessary_literal_unwrap::check(cx, expr, recv);
Some((constructor @ "Some", _, _, _, _)) => {
unnecessary_literal_unwrap::check(cx, expr, recv, constructor);
}
_ => {},
}
unwrap_used::check(cx, expr, recv, false, self.allow_unwrap_in_tests);

View File

@ -6,7 +6,7 @@
use super::UNNECESSARY_LITERAL_UNWRAP;
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>, constructor: &str) {
let obj_ty = cx.typeck_results().expr_ty(recv).peel_refs();
let mess = if is_type_diagnostic_item(cx, obj_ty, sym::Option) {