Skip to content

Commit 680ee79

Browse files
add debug_assert_ne to proposal
1 parent 76c5996 commit 680ee79

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

text/0000-assert_ne.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
`assert_ne` is a macro that takes 2 arguments and panics if they are equal. It
1010
works and is implemented identically to `assert_eq` and serves as its complement.
11+
This proposal also includes a `debug_asset_ne`, matching `debug_assert_eq`.
1112

1213
# Motivation
1314
[motivation]: #motivation
@@ -38,6 +39,14 @@ macro_rules! assert_ne {
3839
}
3940
```
4041

42+
This is complemented by a `debug_assert_ne` (similar to `debug_assert_eq`):
43+
44+
```rust
45+
macro_rules! debug_assert_ne {
46+
($($arg:tt)*) => (if cfg!(debug_assertions) { assert_ne!($($arg)*); })
47+
}
48+
```
49+
4150
# Drawbacks
4251
[drawbacks]: #drawbacks
4352

0 commit comments

Comments
 (0)