@@ -4,82 +4,45 @@ use crate::{fmt, panic};
4
4
#[ doc( hidden) ]
5
5
#[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
6
6
#[ track_caller]
7
- pub fn assert_eq_failed < T , U > ( left : & T , right : & U ) -> !
7
+ pub fn assert_failed < T , U > ( op : & str , left : & T , right : & U ) -> !
8
8
where
9
9
T : fmt:: Debug + ?Sized ,
10
10
U : fmt:: Debug + ?Sized ,
11
11
{
12
12
#[ track_caller]
13
- fn inner ( left : & dyn fmt:: Debug , right : & dyn fmt:: Debug ) -> ! {
13
+ fn inner ( op : & str , left : & dyn fmt:: Debug , right : & dyn fmt:: Debug ) -> ! {
14
14
panic ! (
15
- r#"assertion failed: `(left == right)`
16
- left: `{:?}`,
17
- right: `{:?}`"# ,
18
- left, right
15
+ r#"assertion failed: `(left {} right)`
16
+ left: `{:?}`,
17
+ right: `{:?}`"#,
18
+ op , left, right
19
19
)
20
20
}
21
- inner ( & left, & right)
21
+ inner ( op , & left, & right)
22
22
}
23
23
24
24
#[ cold]
25
25
#[ doc( hidden) ]
26
26
#[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
27
27
#[ track_caller]
28
- pub fn assert_eq_failed_args < T , U > ( left : & T , right : & U , args : fmt:: Arguments < ' _ > ) -> !
28
+ pub fn assert_failed_args < T , U > ( op : & str , left : & T , right : & U , args : fmt:: Arguments < ' _ > ) -> !
29
29
where
30
30
T : fmt:: Debug + ?Sized ,
31
31
U : fmt:: Debug + ?Sized ,
32
32
{
33
33
#[ track_caller]
34
- fn inner ( left : & dyn fmt:: Debug , right : & dyn fmt:: Debug , args : fmt:: Arguments < ' _ > ) -> ! {
34
+ fn inner (
35
+ op : & str ,
36
+ left : & dyn fmt:: Debug ,
37
+ right : & dyn fmt:: Debug ,
38
+ args : fmt:: Arguments < ' _ > ,
39
+ ) -> ! {
35
40
panic ! (
36
- r#"assertion failed: `(left == right)`
37
- left: `{:?}`,
38
- right: `{:?}: {}`"# ,
39
- left, right, args
41
+ r#"assertion failed: `(left {} right)`
42
+ left: `{:?}`,
43
+ right: `{:?}: {}`"#,
44
+ op , left, right, args
40
45
)
41
46
}
42
- inner ( & left, & right, args)
43
- }
44
-
45
- #[ cold]
46
- #[ doc( hidden) ]
47
- #[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
48
- #[ track_caller]
49
- pub fn assert_ne_failed < T , U > ( left : & T , right : & U ) -> !
50
- where
51
- T : fmt:: Debug + ?Sized ,
52
- U : fmt:: Debug + ?Sized ,
53
- {
54
- #[ track_caller]
55
- fn inner ( left : & dyn fmt:: Debug , right : & dyn fmt:: Debug ) -> ! {
56
- panic ! (
57
- r#"assertion failed: `(left != right)`
58
- left: `{:?}`,
59
- right: `{:?}`"# ,
60
- left, right
61
- )
62
- }
63
- inner ( & left, & right)
64
- }
65
-
66
- #[ cold]
67
- #[ doc( hidden) ]
68
- #[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
69
- #[ track_caller]
70
- pub fn assert_ne_failed_args < T , U > ( left : & T , right : & U , args : fmt:: Arguments < ' _ > ) -> !
71
- where
72
- T : fmt:: Debug + ?Sized ,
73
- U : fmt:: Debug + ?Sized ,
74
- {
75
- #[ track_caller]
76
- fn inner ( left : & dyn fmt:: Debug , right : & dyn fmt:: Debug , args : fmt:: Arguments < ' _ > ) -> ! {
77
- panic ! (
78
- r#"assertion failed: `(left != right)`
79
- left: `{:?}`,
80
- right: `{:?}: {}`"# ,
81
- left, right, args
82
- )
83
- }
84
- inner ( & left, & right, args)
47
+ inner ( op, & left, & right, args)
85
48
}
0 commit comments