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 @@ -194,9 +194,9 @@ impl Ascii {
194
194
/// ```
195
195
#[ inline]
196
196
pub fn from ( ch : char ) -> Result < Ascii , ( ) > {
197
- if ch as u32 <= 0x7F {
198
- return Ok ( unsafe { ch. to_ascii_nocheck ( ) } ) ;
199
- }
197
+ unsafe { if ch as u32 <= 0x7F {
198
+ return Ok ( ch. to_ascii_nocheck ( ) ) ;
199
+ } }
200
200
Err ( ( ) )
201
201
}
202
202
@@ -215,16 +215,16 @@ impl Ascii {
215
215
/// ```
216
216
#[ inline]
217
217
pub fn from_byte ( ch : u8 ) -> Result < Ascii , ( ) > {
218
- if ch <= 0x7F {
219
- return Ok ( unsafe { ch. to_ascii_nocheck ( ) } ) ;
220
- }
218
+ unsafe { if ch <= 0x7F {
219
+ return Ok ( ch. to_ascii_nocheck ( ) ) ;
220
+ } }
221
221
Err ( ( ) )
222
222
}
223
223
224
224
/// Converts an ascii character into a `u8`.
225
225
#[ inline]
226
226
pub fn as_byte ( & self ) -> u8 {
227
- unsafe { transmute ( * self ) }
227
+ * self as u8
228
228
}
229
229
230
230
/// Converts an ascii character into a `char`.
You can’t perform that action at this time.
0 commit comments