File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -189,9 +189,9 @@ impl Ascii {
189
189
/// ```
190
190
#[ inline]
191
191
pub fn from ( ch : char ) -> Result < Ascii , ( ) > {
192
- if ch as u32 <= 0x7F {
193
- return Ok ( unsafe { ch. to_ascii_nocheck ( ) } ) ;
194
- }
192
+ unsafe { if ch as u32 <= 0x7F {
193
+ return Ok ( ch. to_ascii_nocheck ( ) ) ;
194
+ } }
195
195
Err ( ( ) )
196
196
}
197
197
@@ -210,16 +210,16 @@ impl Ascii {
210
210
/// ```
211
211
#[ inline]
212
212
pub fn from_byte ( ch : u8 ) -> Result < Ascii , ( ) > {
213
- if ch <= 0x7F {
214
- return Ok ( unsafe { ch. to_ascii_nocheck ( ) } ) ;
215
- }
213
+ unsafe { if ch <= 0x7F {
214
+ return Ok ( ch. to_ascii_nocheck ( ) ) ;
215
+ } }
216
216
Err ( ( ) )
217
217
}
218
218
219
219
/// Converts an ascii character into a `u8`.
220
220
#[ inline]
221
221
pub fn as_byte ( & self ) -> u8 {
222
- unsafe { transmute ( * self ) }
222
+ * self as u8
223
223
}
224
224
225
225
/// Converts an ascii character into a `char`.
You can’t perform that action at this time.
0 commit comments