Fix clippy::redundant_field_names

This commit is contained in:
Zhiming Wang
2020-07-26 01:01:13 +08:00
parent ceb1a7ea7c
commit 73b66ea438
38 changed files with 69 additions and 93 deletions

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),
}