Skip to content

Commit 43e6c65

Browse files
committed
Remove debug_assert from panic_in_result_fn
1 parent f7c2c44 commit 43e6c65

File tree

3 files changed

+9
-67
lines changed

3 files changed

+9
-67
lines changed

clippy_lints/src/panic_in_result_fn.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, body: &'tcx hir
6161
"assert",
6262
"assert_eq",
6363
"assert_ne",
64-
"debug_assert",
65-
"debug_assert_eq",
66-
"debug_assert_ne",
6764
],
6865
body,
6966
);

tests/ui/panic_in_result_fn_debug_assertions.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,45 @@
11
#![warn(clippy::panic_in_result_fn)]
22
#![allow(clippy::unnecessary_wraps)]
33

4+
// debug_assert should never trigger the `panic_in_result_fn` lint
5+
46
struct A;
57

68
impl A {
7-
fn result_with_debug_assert_with_message(x: i32) -> Result<bool, String> // should emit lint
9+
fn result_with_debug_assert_with_message(x: i32) -> Result<bool, String>
810
{
911
debug_assert!(x == 5, "wrong argument");
1012
Ok(true)
1113
}
1214

13-
fn result_with_debug_assert_eq(x: i32) -> Result<bool, String> // should emit lint
15+
fn result_with_debug_assert_eq(x: i32) -> Result<bool, String>
1416
{
1517
debug_assert_eq!(x, 5);
1618
Ok(true)
1719
}
1820

19-
fn result_with_debug_assert_ne(x: i32) -> Result<bool, String> // should emit lint
21+
fn result_with_debug_assert_ne(x: i32) -> Result<bool, String>
2022
{
2123
debug_assert_ne!(x, 1);
2224
Ok(true)
2325
}
2426

25-
fn other_with_debug_assert_with_message(x: i32) // should not emit lint
27+
fn other_with_debug_assert_with_message(x: i32)
2628
{
2729
debug_assert!(x == 5, "wrong argument");
2830
}
2931

30-
fn other_with_debug_assert_eq(x: i32) // should not emit lint
32+
fn other_with_debug_assert_eq(x: i32)
3133
{
3234
debug_assert_eq!(x, 5);
3335
}
3436

35-
fn other_with_debug_assert_ne(x: i32) // should not emit lint
37+
fn other_with_debug_assert_ne(x: i32)
3638
{
3739
debug_assert_ne!(x, 1);
3840
}
3941

40-
fn result_without_banned_functions() -> Result<bool, String> // should not emit lint
42+
fn result_without_banned_functions() -> Result<bool, String>
4143
{
4244
let debug_assert = "debug_assert!";
4345
println!("No {}", debug_assert);

tests/ui/panic_in_result_fn_debug_assertions.stderr

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)