Unverified Commit a6879027 authored by Josh Holmer's avatar Josh Holmer Committed by GitHub

Use Rust 2018 edition idioms (#973)

Automated by running `cargo fix --edition-idioms`
parent be9e42f8
......@@ -7,10 +7,6 @@
// Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
extern crate criterion;
extern crate rand;
extern crate rav1e;
mod predict;
mod transform;
mod me;
......
......@@ -3,8 +3,6 @@
#[cfg(feature = "aom")]
extern crate cmake;
#[cfg(unix)]
extern crate pkg_config;
#[cfg(unix)]
#[cfg(feature = "decode_test")]
extern crate bindgen;
#[cfg(all(target_arch = "x86_64", feature = "nasm"))]
......
......@@ -169,7 +169,7 @@ pub fn parse_cli() -> CliOptions {
}
}
fn parse_config(matches: &ArgMatches) -> EncoderConfig {
fn parse_config(matches: &ArgMatches<'_>) -> EncoderConfig {
let speed = matches.value_of("SPEED").unwrap().parse().unwrap();
let quantizer = matches.value_of("QP").unwrap().parse().unwrap();
let max_interval: u64 = matches.value_of("KEYFRAME_INTERVAL").unwrap().parse().unwrap();
......
......@@ -7,12 +7,10 @@
// Media Patent License 1.0 was not distributed with this source code in the
// PATENTS file, you can obtain it at www.aomedia.org/license/patent.
extern crate clap;
extern crate rav1e;
extern crate y4m;
use y4m;
#[macro_use]
extern crate scan_fmt;
extern crate bitstream_io;
mod common;
mod decoder;
......
......@@ -1066,7 +1066,7 @@ impl CDFContext {
}
impl fmt::Debug for CDFContext {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "CDFContext contains too many numbers to print :-(")
}
}
......@@ -3683,7 +3683,7 @@ pub fn get_mv_class(z: u32, offset: &mut u32) -> usize {
c
}
pub fn encode_mv_component(w: &mut Writer, comp: i32,
pub fn encode_mv_component(w: &mut dyn Writer, comp: i32,
mvcomp: &mut NMVComponent, precision: MvSubpelPrecision) {
assert!(comp != 0);
let mut offset: u32 = 0;
......
......@@ -95,7 +95,7 @@ impl Frame {
/// This data retains any padding, e.g. it uses the width and height specifed in
/// the Y-plane's `cfg` struct, and not the display width and height specied in
/// `FrameInvariants`.
pub fn iter(&self) -> PixelIter {
pub fn iter(&self) -> PixelIter<'_> {
PixelIter::new(&self.planes)
}
}
......
......@@ -10,14 +10,6 @@
#![allow(safe_extern_statics)]
#![allow(clippy::collapsible_if)]
extern crate bitstream_io;
extern crate backtrace;
extern crate libc;
extern crate rand;
extern crate num_traits;
extern crate paste;
#[cfg(all(test, feature="decode_test_dav1d"))]
extern crate dav1d_sys;
......
......@@ -249,7 +249,7 @@ mod nasm {
}
pub fn put_8tap<'a>(
dst: &'a mut PlaneMutSlice<'a>, src: PlaneSlice, width: usize,
dst: &'a mut PlaneMutSlice<'a>, src: PlaneSlice<'_>, width: usize,
height: usize, col_frac: i32, row_frac: i32, mode_x: FilterMode,
mode_y: FilterMode, bit_depth: usize
) {
......@@ -299,7 +299,7 @@ mod nasm {
}
pub fn prep_8tap<'a>(
tmp: &mut [i16], src: PlaneSlice, width: usize, height: usize,
tmp: &mut [i16], src: PlaneSlice<'_>, width: usize, height: usize,
col_frac: i32, row_frac: i32, mode_x: FilterMode, mode_y: FilterMode,
bit_depth: usize
) {
......@@ -395,7 +395,7 @@ mod native {
}
pub fn put_8tap<'a>(
dst: &'a mut PlaneMutSlice<'a>, src: PlaneSlice, width: usize,
dst: &'a mut PlaneMutSlice<'a>, src: PlaneSlice<'_>, width: usize,
height: usize, col_frac: i32, row_frac: i32, mode_x: FilterMode,
mode_y: FilterMode, bit_depth: usize
) {
......@@ -481,7 +481,7 @@ mod native {
}
pub fn prep_8tap<'a>(
tmp: &mut [i16], src: PlaneSlice, width: usize, height: usize,
tmp: &mut [i16], src: PlaneSlice<'_>, width: usize, height: usize,
col_frac: i32, row_frac: i32, mode_x: FilterMode, mode_y: FilterMode,
bit_depth: usize
) {
......
......@@ -59,7 +59,7 @@ mod nasm {
#[target_feature(enable = "ssse3")]
unsafe fn sad_ssse3(
plane_org: &PlaneSlice, plane_ref: &PlaneSlice, blk_h: usize,
plane_org: &PlaneSlice<'_>, plane_ref: &PlaneSlice<'_>, blk_h: usize,
blk_w: usize, bit_depth: usize
) -> u32 {
let mut sum = 0 as u32;
......@@ -92,7 +92,7 @@ mod nasm {
#[inline(always)]
pub fn get_sad(
plane_org: &PlaneSlice, plane_ref: &PlaneSlice, blk_h: usize,
plane_org: &PlaneSlice<'_>, plane_ref: &PlaneSlice<'_>, blk_h: usize,
blk_w: usize, bit_depth: usize
) -> u32 {
#[cfg(all(target_arch = "x86_64", not(windows), feature = "nasm"))]
......@@ -112,7 +112,7 @@ mod native {
#[inline(always)]
pub fn get_sad(
plane_org: &PlaneSlice, plane_ref: &PlaneSlice, blk_h: usize,
plane_org: &PlaneSlice<'_>, plane_ref: &PlaneSlice<'_>, blk_h: usize,
blk_w: usize, _bit_depth: usize
) -> u32 {
let mut sum = 0 as u32;
......
......@@ -43,7 +43,7 @@ pub struct Plane {
}
impl Debug for Plane {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Plane {{ data: [{}, ...], cfg: {:?} }}", self.data[0], self.cfg)
}
}
......@@ -137,11 +137,11 @@ impl Plane {
}
}
pub fn slice(&self, po: &PlaneOffset) -> PlaneSlice {
pub fn slice(&self, po: &PlaneOffset) -> PlaneSlice<'_> {
PlaneSlice { plane: self, x: po.x, y: po.y }
}
pub fn mut_slice(&mut self, po: &PlaneOffset) -> PlaneMutSlice {
pub fn mut_slice(&mut self, po: &PlaneOffset) -> PlaneMutSlice<'_> {
PlaneMutSlice { plane: self, x: po.x, y: po.y }
}
......@@ -213,7 +213,7 @@ impl Plane {
}
/// Iterates over the pixels in the `Plane`, skipping stride data.
pub fn iter(&self) -> PlaneIter {
pub fn iter(&self) -> PlaneIter<'_> {
PlaneIter::new(self)
}
}
......@@ -419,12 +419,12 @@ impl<'a> PlaneMutSlice<'a> {
// FIXME: code duplication with PlaneSlice
/// A slice starting i pixels above the current one.
pub fn go_up(&self, i: usize) -> PlaneSlice {
pub fn go_up(&self, i: usize) -> PlaneSlice<'_> {
PlaneSlice { plane: self.plane, x: self.x, y: self.y - i as isize }
}
/// A slice starting i pixels to the left of the current one.
pub fn go_left(&self, i: usize) -> PlaneSlice {
pub fn go_left(&self, i: usize) -> PlaneSlice<'_> {
PlaneSlice { plane: self.plane, x: self.x - i as isize, y: self.y }
}
......
......@@ -58,7 +58,7 @@ const FWD_TXFM_SHIFT_LS: [TxfmShifts; TxSize::TX_SIZES_ALL] = [
FWD_SHIFT_64X16
];
type TxfmFunc = Fn(&[i32], &mut [i32]);
type TxfmFunc = dyn Fn(&[i32], &mut [i32]);
use std::ops::*;
......
......@@ -146,8 +146,6 @@ pub struct Align32;
/// assert!(x.array.as_ptr() as usize % 16 == 0);
/// ```
pub struct AlignedArray<ARRAY>
where
ARRAY: ?Sized
{
_alignment: [Align32; 0],
pub array: ARRAY
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment