mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-26 23:25: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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
#![feature(alloc, box_syntax, conservative_impl_trait, plugin, proc_macro)]
|
#![feature(conservative_impl_trait, plugin, proc_macro)]
|
||||||
#![plugin(clippy)]
|
#![plugin(clippy)]
|
||||||
|
|
||||||
extern crate alloc;
|
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
extern crate core;
|
extern crate core;
|
||||||
#[macro_use] extern crate chan;
|
#[macro_use] extern crate chan;
|
||||||
|
@ -79,7 +79,6 @@
|
|||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
|
|
||||||
use alloc::raw_vec::RawVec;
|
|
||||||
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
|
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
|
||||||
use db;
|
use db;
|
||||||
use dir;
|
use dir;
|
||||||
@ -366,7 +365,11 @@ impl Mp4Segment {
|
|||||||
let stsz_len = mem::size_of::<u32>() * s.frames as usize;
|
let stsz_len = mem::size_of::<u32>() * s.frames as usize;
|
||||||
let stss_len = mem::size_of::<u32>() * s.key_frames as usize;
|
let stss_len = mem::size_of::<u32>() * s.key_frames as usize;
|
||||||
let len = stts_len + stsz_len + stss_len;
|
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 (stts, mut rest) = buf.split_at_mut(stts_len);
|
||||||
let (stsz, stss) = rest.split_at_mut(stsz_len);
|
let (stsz, stss) = rest.split_at_mut(stsz_len);
|
||||||
|
Loading…
Reference in New Issue
Block a user