File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 11use clippy_utils:: diagnostics:: span_lint_and_help;
2- use clippy_utils:: is_in_cfg_test;
2+ use clippy_utils:: { is_in_cfg_test, is_in_test_function } ;
33use clippy_utils:: ty:: is_type_diagnostic_item;
44use rustc_hir as hir;
55use rustc_lint:: LateContext ;
@@ -27,7 +27,7 @@ pub(super) fn check(
2727
2828 let method = if is_err { "expect_err" } else { "expect" } ;
2929
30- if allow_expect_in_tests && is_in_cfg_test ( cx. tcx , expr. hir_id ) {
30+ if allow_expect_in_tests && ( is_in_test_function ( cx . tcx , expr . hir_id ) || is_in_cfg_test ( cx. tcx , expr. hir_id ) ) {
3131 return ;
3232 }
3333
Original file line number Diff line number Diff line change 11use clippy_utils:: diagnostics:: span_lint_and_help;
22use clippy_utils:: ty:: is_type_diagnostic_item;
3- use clippy_utils:: { is_in_cfg_test, is_lint_allowed} ;
3+ use clippy_utils:: { is_in_cfg_test, is_in_test_function , is_lint_allowed} ;
44use rustc_hir as hir;
55use rustc_lint:: LateContext ;
66use rustc_span:: sym;
@@ -27,7 +27,7 @@ pub(super) fn check(
2727
2828 let method_suffix = if is_err { "_err" } else { "" } ;
2929
30- if allow_unwrap_in_tests && is_in_cfg_test ( cx. tcx , expr. hir_id ) {
30+ if allow_unwrap_in_tests && ( is_in_test_function ( cx . tcx , expr . hir_id ) || is_in_cfg_test ( cx. tcx , expr. hir_id ) ) {
3131 return ;
3232 }
3333
You can’t perform that action at this time.
0 commit comments