Skip to content

Commit 5bb7681

Browse files
rsdypksunkara
authored andcommitted
Add hook
1 parent e707447 commit 5bb7681

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3865,7 +3865,9 @@ impl Methods {
38653865
Some(("or", recv, [or_arg], or_span, _)) => {
38663866
or_then_unwrap::check(cx, expr, recv, or_arg, or_span);
38673867
},
3868-
// unnecessary_literal_unwrap::check(cx, expr, recv);
3868+
Some((constructor @ "Some", _, _, _, _)) => {
3869+
unnecessary_literal_unwrap::check(cx, expr, recv, constructor);
3870+
}
38693871
_ => {},
38703872
}
38713873
unwrap_used::check(cx, expr, recv, false, self.allow_unwrap_in_tests);

clippy_lints/src/methods/unnecessary_literal_unwrap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_span::sym;
66

77
use super::UNNECESSARY_LITERAL_UNWRAP;
88

9-
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) {
9+
pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>, constructor: &str) {
1010
let obj_ty = cx.typeck_results().expr_ty(recv).peel_refs();
1111

1212
let mess = if is_type_diagnostic_item(cx, obj_ty, sym::Option) {

0 commit comments

Comments
 (0)