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 1
1
use 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 } ;
3
3
use clippy_utils:: ty:: is_type_diagnostic_item;
4
4
use rustc_hir as hir;
5
5
use rustc_lint:: LateContext ;
@@ -27,7 +27,7 @@ pub(super) fn check(
27
27
28
28
let method = if is_err { "expect_err" } else { "expect" } ;
29
29
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 ) ) {
31
31
return ;
32
32
}
33
33
Original file line number Diff line number Diff line change 1
1
use clippy_utils:: diagnostics:: span_lint_and_help;
2
2
use 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} ;
4
4
use rustc_hir as hir;
5
5
use rustc_lint:: LateContext ;
6
6
use rustc_span:: sym;
@@ -27,7 +27,7 @@ pub(super) fn check(
27
27
28
28
let method_suffix = if is_err { "_err" } else { "" } ;
29
29
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 ) ) {
31
31
return ;
32
32
}
33
33
You can’t perform that action at this time.
0 commit comments