Fix clippy::redundant_field_names

This commit is contained in:
Zhiming Wang 2020-07-26 01:01:13 +08:00
parent ceb1a7ea7c
commit 73b66ea438
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8
38 changed files with 69 additions and 93 deletions

View File

@ -116,9 +116,9 @@ fn transcoder<P: AsRef<Path>>(
Ok(Transcoder {
stream: input.index(),
filter: filter,
decoder: decoder,
encoder: encoder,
filter,
decoder,
encoder,
})
}

View File

@ -11,7 +11,7 @@ pub struct Audio {
impl Audio {
pub unsafe fn new(codec: Codec) -> Audio {
Audio { codec: codec }
Audio { codec }
}
}
@ -63,7 +63,7 @@ pub struct RateIter {
impl RateIter {
pub fn new(ptr: *const i32) -> Self {
RateIter { ptr: ptr }
RateIter { ptr }
}
}
@ -90,7 +90,7 @@ pub struct FormatIter {
impl FormatIter {
pub fn new(ptr: *const AVSampleFormat) -> Self {
FormatIter { ptr: ptr }
FormatIter { ptr }
}
}
@ -117,7 +117,7 @@ pub struct ChannelLayoutIter {
impl ChannelLayoutIter {
pub fn new(ptr: *const u64) -> Self {
ChannelLayoutIter { ptr: ptr }
ChannelLayoutIter { ptr }
}
pub fn best(self, max: i32) -> ChannelLayout {

View File

@ -15,7 +15,7 @@ unsafe impl Sync for Codec {}
impl Codec {
pub unsafe fn wrap(ptr: *mut AVCodec) -> Self {
Codec { ptr: ptr }
Codec { ptr }
}
pub unsafe fn as_ptr(&self) -> *const AVCodec {
@ -106,7 +106,7 @@ pub struct ProfileIter {
impl ProfileIter {
pub fn new(id: Id, ptr: *const AVProfile) -> Self {
ProfileIter { id: id, ptr: ptr }
ProfileIter { id, ptr }
}
}

View File

@ -18,10 +18,7 @@ unsafe impl Send for Context {}
impl Context {
pub unsafe fn wrap(ptr: *mut AVCodecContext, owner: Option<Rc<dyn Drop>>) -> Self {
Context {
ptr: ptr,
owner: owner,
}
Context { ptr, owner }
}
pub unsafe fn as_ptr(&self) -> *const AVCodecContext {

View File

@ -18,10 +18,7 @@ impl<'a> Borrow<'a> {
packet.data = data.as_ptr() as *mut _;
packet.size = data.len() as c_int;
Borrow {
packet: packet,
data: data,
}
Borrow { packet, data }
}
}

View File

@ -282,7 +282,7 @@ pub struct SideDataIter<'a> {
impl<'a> SideDataIter<'a> {
pub fn new(ptr: *const AVPacket) -> Self {
SideDataIter {
ptr: ptr,
ptr,
cur: 0,
_marker: PhantomData,
}

View File

@ -155,7 +155,7 @@ pub struct SideData<'a> {
impl<'a> SideData<'a> {
pub unsafe fn wrap(ptr: *mut AVPacketSideData) -> Self {
SideData {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}

View File

@ -13,10 +13,7 @@ unsafe impl Send for Parameters {}
impl Parameters {
pub unsafe fn wrap(ptr: *mut AVCodecParameters, owner: Option<Rc<dyn Drop>>) -> Self {
Parameters {
ptr: ptr,
owner: owner,
}
Parameters { ptr, owner }
}
pub unsafe fn as_ptr(&self) -> *const AVCodecParameters {

View File

@ -26,11 +26,11 @@ impl<'a> Picture<'a> {
height: u32,
) -> Self {
Picture {
ptr: ptr,
ptr,
format: format,
width: width,
height: height,
format,
width,
height,
_own: false,
_marker: PhantomData,
@ -62,11 +62,11 @@ impl<'a> Picture<'a> {
match avpicture_alloc(ptr, format.into(), width as c_int, height as c_int) {
0 => Ok(Picture {
ptr: ptr,
ptr,
format: format,
width: width,
height: height,
format,
width,
height,
_own: true,
_marker: PhantomData,

View File

@ -131,7 +131,7 @@ pub struct RectIter<'a> {
impl<'a> RectIter<'a> {
pub fn new(ptr: *const AVSubtitle) -> Self {
RectIter {
ptr: ptr,
ptr,
cur: 0,
_marker: PhantomData,
}
@ -175,7 +175,7 @@ pub struct RectMutIter<'a> {
impl<'a> RectMutIter<'a> {
pub fn new(ptr: *mut AVSubtitle) -> Self {
RectMutIter {
ptr: ptr,
ptr,
cur: 0,
_marker: PhantomData,
}

View File

@ -55,7 +55,7 @@ pub struct Bitmap<'a> {
impl<'a> Bitmap<'a> {
pub unsafe fn wrap(ptr: *const AVSubtitleRect) -> Self {
Bitmap {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}
@ -108,7 +108,7 @@ pub struct Text<'a> {
impl<'a> Text<'a> {
pub unsafe fn wrap(ptr: *const AVSubtitleRect) -> Self {
Text {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}
@ -133,7 +133,7 @@ pub struct Ass<'a> {
impl<'a> Ass<'a> {
pub unsafe fn wrap(ptr: *const AVSubtitleRect) -> Self {
Ass {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}

View File

@ -11,7 +11,7 @@ pub struct Video {
impl Video {
pub unsafe fn new(codec: Codec) -> Video {
Video { codec: codec }
Video { codec }
}
}
@ -51,7 +51,7 @@ pub struct RateIter {
impl RateIter {
pub fn new(ptr: *const AVRational) -> Self {
RateIter { ptr: ptr }
RateIter { ptr }
}
}
@ -78,7 +78,7 @@ pub struct FormatIter {
impl FormatIter {
pub fn new(ptr: *const AVPixelFormat) -> Self {
FormatIter { ptr: ptr }
FormatIter { ptr }
}
}

View File

@ -28,7 +28,7 @@ impl<'a> DeviceIter<'a> {
n if n < 0 => Err(Error::from(n)),
_ => Ok(DeviceIter {
ptr: ptr,
ptr,
cur: 0,
_marker: PhantomData,
}),

View File

@ -17,7 +17,7 @@ pub struct Info<'a> {
impl<'a> Info<'a> {
pub unsafe fn wrap(ptr: *mut AVDeviceInfo) -> Self {
Info {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}

View File

@ -14,7 +14,7 @@ pub struct Context<'a> {
impl<'a> Context<'a> {
pub unsafe fn wrap(ptr: *mut AVFilterContext) -> Self {
Context {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}

View File

@ -9,7 +9,7 @@ pub struct Sink<'a> {
impl<'a> Sink<'a> {
pub unsafe fn wrap<'b>(ctx: &'b mut Context<'b>) -> Sink<'b> {
Sink { ctx: ctx }
Sink { ctx }
}
}

View File

@ -10,7 +10,7 @@ pub struct Source<'a> {
impl<'a> Source<'a> {
pub unsafe fn wrap<'b>(ctx: &'b mut Context<'b>) -> Source<'b> {
Source { ctx: ctx }
Source { ctx }
}
}

View File

@ -11,7 +11,7 @@ pub struct Filter {
impl Filter {
pub unsafe fn wrap(ptr: *mut AVFilter) -> Self {
Filter { ptr: ptr }
Filter { ptr }
}
pub unsafe fn as_ptr(&self) -> *const AVFilter {
@ -79,7 +79,7 @@ pub struct PadIter<'a> {
impl<'a> PadIter<'a> {
pub fn new(ptr: *const AVFilterPad) -> Self {
PadIter {
ptr: ptr,
ptr,
cur: 0,
_marker: PhantomData,
}

View File

@ -16,7 +16,7 @@ unsafe impl Sync for Graph {}
impl Graph {
pub unsafe fn wrap(ptr: *mut AVFilterGraph) -> Self {
Graph { ptr: ptr }
Graph { ptr }
}
pub unsafe fn as_ptr(&self) -> *const AVFilterGraph {
@ -136,7 +136,7 @@ pub struct Parser<'a> {
impl<'a> Parser<'a> {
pub fn new(graph: &mut Graph) -> Parser {
Parser {
graph: graph,
graph,
inputs: ptr::null_mut(),
outputs: ptr::null_mut(),
}

View File

@ -15,8 +15,8 @@ pub struct Pad<'a> {
impl<'a> Pad<'a> {
pub unsafe fn wrap(ptr: *const AVFilterPad, idx: isize) -> Self {
Pad {
ptr: ptr,
idx: idx,
ptr,
idx,
_marker: PhantomData,
}
}

View File

@ -12,10 +12,7 @@ pub struct Chapter<'a> {
impl<'a> Chapter<'a> {
pub unsafe fn wrap(context: &Context, index: usize) -> Chapter {
Chapter {
context: context,
index: index,
}
Chapter { context, index }
}
pub unsafe fn as_ptr(&self) -> *const AVChapter {

View File

@ -19,7 +19,7 @@ impl<'a> ChapterMut<'a> {
pub unsafe fn wrap(context: &mut Context, index: usize) -> ChapterMut {
ChapterMut {
context: mem::transmute_copy(&context),
index: index,
index,
immutable: Chapter::wrap(mem::transmute_copy(&context), index),
}

View File

@ -17,7 +17,7 @@ unsafe impl Send for Context {}
impl Context {
pub unsafe fn wrap(ptr: *mut AVFormatContext, mode: destructor::Mode) -> Self {
Context {
ptr: ptr,
ptr,
dtor: Rc::new(Destructor::new(ptr, mode)),
}
}
@ -131,7 +131,7 @@ pub struct Best<'a> {
impl<'a> Best<'a> {
pub unsafe fn new<'b, 'c: 'b>(context: &'c Context) -> Best<'b> {
Best {
context: context,
context,
wanted: -1,
related: -1,
@ -186,7 +186,7 @@ pub struct StreamIter<'a> {
impl<'a> StreamIter<'a> {
pub fn new<'s, 'c: 's>(context: &'c Context) -> StreamIter<'s> {
StreamIter {
context: context,
context,
current: 0,
}
}
@ -254,7 +254,7 @@ pub struct StreamIterMut<'a> {
impl<'a> StreamIterMut<'a> {
pub fn new<'s, 'c: 's>(context: &'c mut Context) -> StreamIterMut<'s> {
StreamIterMut {
context: context,
context,
current: 0,
}
}
@ -300,7 +300,7 @@ pub struct ChapterIter<'a> {
impl<'a> ChapterIter<'a> {
pub fn new<'s, 'c: 's>(context: &'c Context) -> ChapterIter<'s> {
ChapterIter {
context: context,
context,
current: 0,
}
}
@ -343,7 +343,7 @@ pub struct ChapterIterMut<'a> {
impl<'a> ChapterIterMut<'a> {
pub fn new<'s, 'c: 's>(context: &'c mut Context) -> ChapterIterMut<'s> {
ChapterIterMut {
context: context,
context,
current: 0,
}
}

View File

@ -13,10 +13,7 @@ pub struct Destructor {
impl Destructor {
pub unsafe fn new(ptr: *mut AVFormatContext, mode: Mode) -> Self {
Destructor {
ptr: ptr,
mode: mode,
}
Destructor { ptr, mode }
}
}

View File

@ -19,7 +19,7 @@ unsafe impl Send for Input {}
impl Input {
pub unsafe fn wrap(ptr: *mut AVFormatContext) -> Self {
Input {
ptr: ptr,
ptr,
ctx: Context::wrap(ptr, destructor::Mode::Input),
}
}
@ -149,7 +149,7 @@ pub struct PacketIter<'a> {
impl<'a> PacketIter<'a> {
pub fn new(context: &mut Input) -> PacketIter {
PacketIter { context: context }
PacketIter { context }
}
}

View File

@ -21,7 +21,7 @@ unsafe impl Send for Output {}
impl Output {
pub unsafe fn wrap(ptr: *mut AVFormatContext) -> Self {
Output {
ptr: ptr,
ptr,
ctx: Context::wrap(ptr, destructor::Mode::Output),
}
}

View File

@ -9,7 +9,7 @@ pub struct Input {
impl Input {
pub unsafe fn wrap(ptr: *mut AVInputFormat) -> Self {
Input { ptr: ptr }
Input { ptr }
}
pub unsafe fn as_ptr(&self) -> *const AVInputFormat {

View File

@ -14,7 +14,7 @@ pub struct Output {
impl Output {
pub unsafe fn wrap(ptr: *mut AVOutputFormat) -> Self {
Output { ptr: ptr }
Output { ptr }
}
pub unsafe fn as_ptr(&self) -> *const AVOutputFormat {

View File

@ -12,10 +12,7 @@ pub struct Stream<'a> {
impl<'a> Stream<'a> {
pub unsafe fn wrap(context: &Context, index: usize) -> Stream {
Stream {
context: context,
index: index,
}
Stream { context, index }
}
pub unsafe fn as_ptr(&self) -> *const AVStream {
@ -98,10 +95,7 @@ pub struct SideDataIter<'a> {
impl<'a> SideDataIter<'a> {
pub fn new<'sd, 's: 'sd>(stream: &'s Stream) -> SideDataIter<'sd> {
SideDataIter {
stream: stream,
current: 0,
}
SideDataIter { stream, current: 0 }
}
}

View File

@ -17,7 +17,7 @@ impl<'a> StreamMut<'a> {
pub unsafe fn wrap(context: &mut Context, index: usize) -> StreamMut {
StreamMut {
context: mem::transmute_copy(&context),
index: index,
index,
immutable: Stream::wrap(mem::transmute_copy(&context), index),
}

View File

@ -60,7 +60,7 @@ impl Context {
e if e < 0 => Err(Error::from(e)),
_ => Ok(Context {
ptr: ptr,
ptr,
input: Definition {
format: src_format,

View File

@ -58,7 +58,7 @@ impl Context {
if !ptr.is_null() {
Ok(Context {
ptr: ptr,
ptr,
input: Definition {
format: src_format,

View File

@ -14,7 +14,7 @@ pub struct Vector<'a> {
impl<'a> Vector<'a> {
pub unsafe fn wrap(ptr: *mut SwsVector) -> Self {
Vector {
ptr: ptr,
ptr,
_own: false,
_marker: PhantomData,
}

View File

@ -15,7 +15,7 @@ pub struct Ref<'a> {
impl<'a> Ref<'a> {
pub unsafe fn wrap(ptr: *const AVDictionary) -> Self {
Ref {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}

View File

@ -15,7 +15,7 @@ pub struct Ref<'a> {
impl<'a> Ref<'a> {
pub unsafe fn wrap(ptr: *mut AVDictionary) -> Self {
Ref {
ptr: ptr,
ptr,
imm: immutable::Ref::wrap(ptr),
_marker: PhantomData,
}

View File

@ -153,10 +153,10 @@ impl Buffer {
pub fn new(format: Sample, channels: u16, samples: usize, align: bool) -> Self {
unsafe {
let mut buf = Buffer {
format: format,
channels: channels,
samples: samples,
align: align,
format,
channels,
samples,
align,
buffer: ptr::null_mut(),
size: 0,

View File

@ -37,10 +37,7 @@ unsafe impl Sync for Frame {}
impl Frame {
#[inline(always)]
pub unsafe fn wrap(ptr: *mut AVFrame) -> Self {
Frame {
ptr: ptr,
_own: false,
}
Frame { ptr, _own: false }
}
#[inline(always)]

View File

@ -146,7 +146,7 @@ impl<'a> SideData<'a> {
#[inline(always)]
pub unsafe fn wrap(ptr: *mut AVFrameSideData) -> Self {
SideData {
ptr: ptr,
ptr,
_marker: PhantomData,
}
}