File tree Expand file tree Collapse file tree 4 files changed +5
-8
lines changed
Expand file tree Collapse file tree 4 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ impl FrameID {
4141
4242 pub ( crate ) fn verify_id ( id_str : & str ) -> Result < ( ) > {
4343 for c in id_str. chars ( ) {
44- if !( 'A' ..= 'Z' ) . contains ( & c ) && !( '0' ..= '9' ) . contains ( & c ) {
44+ if !c . is_ascii_uppercase ( ) && !c . is_ascii_digit ( ) {
4545 return Err ( ID3v2Error :: new ( ID3v2ErrorKind :: BadFrameID ) . into ( ) ) ;
4646 }
4747 }
@@ -59,7 +59,7 @@ impl TryFrom<&ItemKey> for FrameID {
5959 if unknown. len ( ) == 4
6060 && unknown
6161 . chars ( )
62- . all ( |c| ( 'A' ..= 'Z' ) . contains ( & c ) || ( '0' ..= '9' ) . contains ( & c ) ) =>
62+ . all ( |c| c . is_ascii_uppercase ( ) || c . is_ascii_digit ( ) ) =>
6363 {
6464 Ok ( Self :: Valid ( unknown. clone ( ) ) )
6565 } ,
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ impl LanguageFrame {
4242 pub fn as_bytes ( & self ) -> Result < Vec < u8 > > {
4343 let mut bytes = vec ! [ self . encoding as u8 ] ;
4444
45- if self . language . len ( ) != 3 || self . language . iter ( ) . any ( |c| !( b'a' ..= b'z' ) . contains ( & c ) ) {
45+ if self . language . len ( ) != 3 || self . language . iter ( ) . any ( |c| !c . is_ascii_lowercase ( ) ) {
4646 return Err ( ID3v2Error :: new ( ID3v2ErrorKind :: Other (
4747 "Invalid frame language found (expected 3 ascii characters)" ,
4848 ) )
Original file line number Diff line number Diff line change @@ -192,10 +192,7 @@ impl SynchronizedText {
192192 let mut data = vec ! [ information. encoding as u8 ] ;
193193
194194 if information. language . len ( ) == 3
195- && information
196- . language
197- . chars ( )
198- . all ( |c| ( 'a' ..='z' ) . contains ( & c) )
195+ && information. language . chars ( ) . all ( |c| c. is_ascii_lowercase ( ) )
199196 {
200197 data. write_all ( information. language . as_bytes ( ) ) ?;
201198 data. write_u8 ( information. timestamp_format as u8 ) ?;
Original file line number Diff line number Diff line change @@ -39,5 +39,5 @@ pub(super) fn verify_key(key: &str) -> bool {
3939 key. len ( ) == 4
4040 && key
4141 . chars ( )
42- . all ( |c| ( 'A' ..= 'Z' ) . contains ( & c ) || ( '0' ..= '9' ) . contains ( & c ) )
42+ . all ( |c| c . is_ascii_uppercase ( ) || c . is_ascii_digit ( ) )
4343}
You can’t perform that action at this time.
0 commit comments