-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
I think it would make sense to suggest using byte string literals instead of calling as_bytes() on &str literals, since byte string literals are less noisy. There is a surprising amount of rust code that uses as_bytes on string literals. Some of it exists because beginners might not know that they can do b"foo" instead of "foo".as_bytes(), some of it seems to pre-date the introduction of byte-string literals.
Complication: the two aren't equivalent if the string literal contains non-ascii characters, so we cannot suggest using b"☃" instead of "☃".as_bytes(), because the former would not compile.
Metadata
Metadata
Assignees
Labels
No labels