@@ -4,82 +4,45 @@ use crate::{fmt, panic};
44#[ doc( hidden) ]
55#[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
66#[ 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 ) -> !
88where
99 T : fmt:: Debug + ?Sized ,
1010 U : fmt:: Debug + ?Sized ,
1111{
1212 #[ 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 ) -> ! {
1414 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
1919 )
2020 }
21- inner ( & left, & right)
21+ inner ( op , & left, & right)
2222}
2323
2424#[ cold]
2525#[ doc( hidden) ]
2626#[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
2727#[ 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 < ' _ > ) -> !
2929where
3030 T : fmt:: Debug + ?Sized ,
3131 U : fmt:: Debug + ?Sized ,
3232{
3333 #[ 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+ ) -> ! {
3540 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
4045 )
4146 }
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)
8548}
0 commit comments