File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -96,25 +96,25 @@ impl Ascii {
96
96
/// Checks if the character is printable (except space)
97
97
#[ inline]
98
98
pub fn is_graph ( & self ) -> bool {
99
- ( self . chr - 0x21 ) < 0x5E
99
+ self . chr . wrapping_sub ( 0x21 ) < 0x5E
100
100
}
101
101
102
102
/// Checks if the character is printable (including space)
103
103
#[ inline]
104
104
pub fn is_print ( & self ) -> bool {
105
- ( self . chr - 0x20 ) < 0x5F
105
+ self . chr . wrapping_sub ( 0x20 ) < 0x5F
106
106
}
107
107
108
108
/// Checks if the character is alphabetic and lowercase
109
109
#[ inline]
110
110
pub fn is_lowercase ( & self ) -> bool {
111
- ( self . chr - b'a' ) < 26
111
+ self . chr . wrapping_sub ( b'a' ) < 26
112
112
}
113
113
114
114
/// Checks if the character is alphabetic and uppercase
115
115
#[ inline]
116
116
pub fn is_uppercase ( & self ) -> bool {
117
- ( self . chr - b'A' ) < 26
117
+ self . chr . wrapping_sub ( b'A' ) < 26
118
118
}
119
119
120
120
/// Checks if the character is punctuation
@@ -126,7 +126,7 @@ impl Ascii {
126
126
/// Checks if the character is a valid hex digit
127
127
#[ inline]
128
128
pub fn is_hex ( & self ) -> bool {
129
- self . is_digit ( ) || ( ( self . chr | 32u8 ) - b'a' ) < 6
129
+ self . is_digit ( ) || ( self . chr | 32u8 ) . wrapping_sub ( b'a' ) < 6
130
130
}
131
131
}
132
132
You can’t perform that action at this time.
0 commit comments