mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-25 22:55:55 -05:00
stop using a couple unstable features
It would be nice to build on stable Rust. In particular, I'm hitting compiler bugs in Rust nightly, such at this one: https://github.com/rust-lang/rust/issues/38177 I imagine beta/stable compilers would be less problematic. These two features were easy to get rid of: * alloc was used to get a Box<[u8]> to uninitialized memory. Looks like that's possible with Vec. * box_syntax wasn't actually used at all. (Maybe a leftover from something.) The remaining features are: * plugin, for clippy. https://github.com/rust-lang/rust/issues/29597 I could easily gate it with a "nightly" cargo feature. * proc_macro, for serde_derive. https://github.com/rust-lang/rust/issues/35900 serde does support stable rust, although it's annoying. https://serde.rs/codegen-stable.html I might just wait a bit; this feature looks like it's getting close to stabilization.
This commit is contained in:
parent
474b5403a9
commit
678500bc88
@ -29,10 +29,9 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#![cfg_attr(test, feature(test))]
|
||||
#![feature(alloc, box_syntax, conservative_impl_trait, plugin, proc_macro)]
|
||||
#![feature(conservative_impl_trait, plugin, proc_macro)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
extern crate alloc;
|
||||
extern crate byteorder;
|
||||
extern crate core;
|
||||
#[macro_use] extern crate chan;
|
||||
|
@ -79,7 +79,6 @@
|
||||
extern crate byteorder;
|
||||
extern crate time;
|
||||
|
||||
use alloc::raw_vec::RawVec;
|
||||
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
|
||||
use db;
|
||||
use dir;
|
||||
@ -366,7 +365,11 @@ impl Mp4Segment {
|
||||
let stsz_len = mem::size_of::<u32>() * s.frames as usize;
|
||||
let stss_len = mem::size_of::<u32>() * s.key_frames as usize;
|
||||
let len = stts_len + stsz_len + stss_len;
|
||||
let mut buf = unsafe { RawVec::with_capacity(len).into_box() };
|
||||
let mut buf = unsafe {
|
||||
let mut v = Vec::with_capacity(len);
|
||||
v.set_len(len);
|
||||
v.into_boxed_slice()
|
||||
};
|
||||
{
|
||||
let (stts, mut rest) = buf.split_at_mut(stts_len);
|
||||
let (stsz, stss) = rest.split_at_mut(stsz_len);
|
||||
|
Loading…
Reference in New Issue
Block a user