From db2fcecdc38ea7a43b098c6282dd906b73981f97 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 1 May 2022 22:58:20 -0500 Subject: Change some generics to impl Trait --- azalea-nbt/src/decode.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/azalea-nbt/src/decode.rs b/azalea-nbt/src/decode.rs index 52f1c97e..7f2ca754 100755 --- a/azalea-nbt/src/decode.rs +++ b/azalea-nbt/src/decode.rs @@ -7,10 +7,7 @@ use std::io::BufRead; use std::io::Read; #[inline] -fn read_string(stream: &mut R) -> Result -where - R: Read, -{ +fn read_string(stream: &mut impl Read) -> Result { let length = stream.read_u16::()?; let mut buf = Vec::with_capacity(length as usize); @@ -22,10 +19,7 @@ where impl Tag { #[inline] - fn read_known(stream: &mut R, id: u8) -> Result - where - R: Read, - { + fn read_known(stream: &mut impl Read, id: u8) -> Result { let tag = match id { // Signifies the end of a TAG_Compound. It is only ever used inside // a TAG_Compound, and is not named despite being in a TAG_Compound @@ -116,10 +110,7 @@ impl Tag { Ok(tag) } - pub fn read(stream: &mut R) -> Result - where - R: Read, - { + pub fn read(stream: &mut impl Read) -> Result { // default to compound tag // the parent compound only ever has one item @@ -135,18 +126,12 @@ impl Tag { Ok(Tag::Compound(map)) } - pub fn read_zlib(stream: &mut R) -> Result - where - R: BufRead, - { + pub fn read_zlib(stream: &mut impl BufRead) -> Result { let mut gz = ZlibDecoder::new(stream); Tag::read(&mut gz) } - pub fn read_gzip(stream: &mut R) -> Result - where - R: Read, - { + pub fn read_gzip(stream: &mut impl Read) -> Result { let mut gz = GzDecoder::new(stream); Tag::read(&mut gz) } -- cgit v1.2.3