Closed
Description
I noticed this is_ascii
check:
rust/src/libcore/char/methods.rs
Line 1078 in 6187684
Then someone told me it's there because of the
as u8
. If you pass a non-ASCII char, the as u8
would corrupt that char. That's why the is_ascii
check is there before it. But then I wondered: why isn't this just cast to a bigger data type that includes all Unicode code points? This method (and others) are slower than they have to be.Also see this discussion in Discord with more valuable information: https://discordapp.com/channels/442252698964721669/443150878111694848/629982972052897792.