Skip to content

Commit 904fb63

Browse files
committed
Fix nightly build by fixing deprecation warnings
1 parent 45c3dae commit 904fb63

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/atom.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ impl<Static: StaticAtomSet> Serialize for Atom<Static> {
450450

451451
impl<'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.
461461
impl<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) };

string-cache-codegen/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)