Skip to content

Commit af2d476

Browse files
committed
Simplify syntax for byte-slice assertions
1 parent 7108565 commit af2d476

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

bindgen-integration/build.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ impl ParseCallbacks for MacroCallback {
7676
// change in the future, but it is safe by the definition of a
7777
// token in C, whereas leaving the spaces out could change
7878
// tokenization.
79-
assert_eq!(
80-
value,
81-
&["-".as_bytes(), "TESTMACRO_INTEGER".as_bytes()]
82-
);
79+
assert_eq!(value, &[b"-" as &[u8], b"TESTMACRO_INTEGER"]);
8380
*self.seen_funcs.lock().unwrap() += 1;
8481
}
8582
"TESTMACRO_FUNCTIONAL_EMPTY(TESTMACRO_INTEGER)" => {
@@ -89,11 +86,7 @@ impl ParseCallbacks for MacroCallback {
8986
"TESTMACRO_FUNCTIONAL_TOKENIZED(a,b,c,d,e)" => {
9087
assert_eq!(
9188
value,
92-
["a", "/", "b", "c", "d", "##", "e"]
93-
.iter()
94-
.map(|s| s.as_bytes())
95-
.collect::<Vec<_>>()
96-
.as_slice()
89+
&[b"a" as &[u8], b"/", b"b", b"c", b"d", b"##", b"e"]
9790
);
9891
*self.seen_funcs.lock().unwrap() += 1;
9992
}

0 commit comments

Comments
 (0)