You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, bytes!() just converts a string literal into a &[u8].
However, to be even more useful for low level stuff it could accept a list of anything reasonably convertible to a list of u8s, like strings, chars in ascii range, explicit u8s etc.
Then you could do for example:
bytes!("foo", 0) - vector of the bytes in "foo" and a null terminator.
bytes!('a', 42, 'b', 98, 'c', 255) - some kind of binary data format.
bytes!(" ", ' ', 32) - a vector of three 32u8.
The text was updated successfully, but these errors were encountered:
Change unusual_byte_groupings to require byte groupings of equal size
Fixes issue rust-lang#6556
This lint required byte groupings of size 2 or 4 for `Radix::Binary` and `Radix::Hexadecimal`. Since there are good reasons for allowing groups of other sizes, this PR relaxes the restriction. This lint now requires that
- group sizes after the first group be of the same size and
- greater or equal in size to the first group.
---
changelog: [`unusual_byte_groupings`]: reduce false positives by relaxing restriction requiring groups of specific sizes.
At the moment,
bytes!()
just converts a string literal into a&[u8]
.However, to be even more useful for low level stuff it could accept a list of anything reasonably convertible to a list of
u8
s, like strings, chars in ascii range, explicitu8
s etc.Then you could do for example:
bytes!("foo", 0)
- vector of the bytes in "foo" and a null terminator.bytes!('a', 42, 'b', 98, 'c', 255)
- some kind of binary data format.bytes!(" ", ' ', 32)
- a vector of three32u8
.The text was updated successfully, but these errors were encountered: