From cc3918f7fb86fb1b04063a5f4f4dd2b5e284eb85 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 20 May 2023 14:03:55 +0200 Subject: remove box_syntax --- bv1/codec/src/encode.rs | 2 +- bv1/codec/src/huff.rs | 10 ++++++---- bv1/codec/src/lib.rs | 1 - bv1/codec/src/serialize.rs | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'bv1/codec/src') diff --git a/bv1/codec/src/encode.rs b/bv1/codec/src/encode.rs index 2f40c07..31e1066 100644 --- a/bv1/codec/src/encode.rs +++ b/bv1/codec/src/encode.rs @@ -88,7 +88,7 @@ pub fn encode_block(last_frame: &Frame, frame: &Frame, view: View, config: &Enco || encode_block(last_frame, frame, av, config), || encode_block(last_frame, frame, bv, config), ); - return Block::Split(box ab, box bb); + return Block::Split(Box::new(ab), Box::new(bb)); } let mut r = Ref::default(); diff --git a/bv1/codec/src/huff.rs b/bv1/codec/src/huff.rs index 6d74c42..0dbb6ce 100644 --- a/bv1/codec/src/huff.rs +++ b/bv1/codec/src/huff.rs @@ -22,7 +22,6 @@ pub fn write_huff(buf: &[u8], w: &mut impl Write) -> Result { tree.create_lut(&mut table, 1); tree.write(&mut w)?; - for b in buf { let mut k = table[*b as usize]; while k != 1 { @@ -30,7 +29,7 @@ pub fn write_huff(buf: &[u8], w: &mut impl Write) -> Result { k >>= 1; } } - + w.flush()?; Ok(w.position) } @@ -76,7 +75,7 @@ impl HT { while parts.len() != 1 { parts.sort_by_key(|e| -(e.0 as isize)); let ((ap, at), (bp, bt)) = (parts.pop().unwrap(), parts.pop().unwrap()); - parts.push((ap + bp + 1, HT::Branch(box at, box bt))) + parts.push((ap + bp + 1, HT::Branch(Box::new(at), Box::new(bt)))) } parts[0].1.clone() } @@ -119,7 +118,10 @@ impl HT { } pub fn read(r: &mut BitIO) -> Result { match r.rbit()? { - false => Ok(Self::Branch(box Self::read(r)?, box Self::read(r)?)), + false => Ok(Self::Branch( + Box::new(Self::read(r)?), + Box::new(Self::read(r)?), + )), true => Ok(Self::Terminal(r.rbyte()?)), } } diff --git a/bv1/codec/src/lib.rs b/bv1/codec/src/lib.rs index a88d8c5..da5c595 100644 --- a/bv1/codec/src/lib.rs +++ b/bv1/codec/src/lib.rs @@ -1,6 +1,5 @@ #![feature(portable_simd)] #![feature(io_error_other)] -#![feature(box_syntax)] pub mod debug; pub mod decode; diff --git a/bv1/codec/src/serialize.rs b/bv1/codec/src/serialize.rs index 960aa1b..86b2919 100644 --- a/bv1/codec/src/serialize.rs +++ b/bv1/codec/src/serialize.rs @@ -80,8 +80,8 @@ impl Block { 0 => { let [av, bv] = split(view); Ok(Block::Split( - box Block::read(r, av)?, - box Block::read(r, bv)?, + Box::new(Block::read(r, av)?), + Box::new(Block::read(r, bv)?), )) } 1 => { -- cgit v1.2.3-70-g09d2