Add hook
This commit is contained in:
parent
e707447a86
commit
5bb768177e
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user