File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,7 @@ impl<Static: StaticAtomSet> Serialize for Atom<Static> {
450450
451451impl < ' a , Static : StaticAtomSet > Deserialize < ' a > for Atom < Static > {
452452 fn deserialize < D > ( deserializer : D ) -> Result < Self , D :: Error > where D : Deserializer < ' a > {
453- let string: String = try! ( Deserialize :: deserialize ( deserializer) ) ;
453+ let string: String = Deserialize :: deserialize ( deserializer) ? ;
454454 Ok ( Atom :: from ( string) )
455455 }
456456}
@@ -460,7 +460,9 @@ impl<'a, Static: StaticAtomSet> Deserialize<'a> for Atom<Static> {
460460// over the one from &str.
461461impl < Static : StaticAtomSet > Atom < Static > {
462462 fn from_mutated_str < F : FnOnce ( & mut str ) > ( s : & str , f : F ) -> Self {
463- let mut buffer: [ u8 ; 64 ] = unsafe { mem:: uninitialized ( ) } ;
463+ let mut buffer = mem:: MaybeUninit :: < [ u8 ; 64 ] > :: uninit ( ) ;
464+ let buffer = unsafe { & mut * buffer. as_mut_ptr ( ) } ;
465+
464466 if let Some ( buffer_prefix) = buffer. get_mut ( ..s. len ( ) ) {
465467 buffer_prefix. copy_from_slice ( s. as_bytes ( ) ) ;
466468 let as_str = unsafe { :: std:: str:: from_utf8_unchecked_mut ( buffer_prefix) } ;
Original file line number Diff line number Diff line change @@ -269,6 +269,6 @@ impl AtomType {
269269 /// Typical usage:
270270 /// `.write_to_file(&Path::new(&env::var("OUT_DIR").unwrap()).join("foo_atom.rs"))`
271271 pub fn write_to_file ( & mut self , path : & Path ) -> io:: Result < ( ) > {
272- self . write_to ( BufWriter :: new ( try! ( File :: create ( path) ) ) )
272+ self . write_to ( BufWriter :: new ( File :: create ( path) ? ) )
273273 }
274274}
You can’t perform that action at this time.
0 commit comments