Merge pull request #135 from Polochon-street/fix-clippy

Fix clippy (again)
This commit is contained in:
Polochon-street
2023-03-12 14:07:21 +01:00
committed by GitHub
9 changed files with 27 additions and 20 deletions
+3 -3
View File
@@ -121,7 +121,7 @@ impl Packet {
pub fn pts(&self) -> Option<i64> {
match self.0.pts {
AV_NOPTS_VALUE => None,
pts => Some(pts as i64),
pts => Some(pts),
}
}
@@ -134,7 +134,7 @@ impl Packet {
pub fn dts(&self) -> Option<i64> {
match self.0.dts {
AV_NOPTS_VALUE => None,
dts => Some(dts as i64),
dts => Some(dts),
}
}
@@ -150,7 +150,7 @@ impl Packet {
#[inline]
pub fn duration(&self) -> i64 {
self.0.duration as i64
self.0.duration
}
#[inline]
+4 -1
View File
@@ -189,6 +189,9 @@ impl<'a> SideData<'a> {
}
pub fn data(&self) -> &[u8] {
unsafe { slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size as usize) }
#[allow(clippy::unnecessary_cast)]
unsafe {
slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size as usize)
}
}
}
+2 -2
View File
@@ -73,7 +73,7 @@ impl Subtitle {
}
pub fn start(&self) -> u32 {
self.0.start_display_time as u32
self.0.start_display_time
}
pub fn set_start(&mut self, value: u32) {
@@ -81,7 +81,7 @@ impl Subtitle {
}
pub fn end(&self) -> u32 {
self.0.end_display_time as u32
self.0.end_display_time
}
pub fn set_end(&mut self, value: u32) {
+4 -1
View File
@@ -26,7 +26,10 @@ impl<'a> Chapter<'a> {
}
pub fn id(&self) -> i64 {
unsafe { (*self.as_ptr()).id as i64 }
#[allow(clippy::unnecessary_cast)]
unsafe {
(*self.as_ptr()).id as i64
}
}
pub fn time_base(&self) -> Rational {
+1 -1
View File
@@ -81,7 +81,7 @@ impl<'a, 'b> FromIterator<&'b (String, String)> for Owned<'a> {
fn from_iter<T: IntoIterator<Item = &'b (String, String)>>(iterator: T) -> Self {
let mut result = Owned::new();
for &(ref key, ref value) in iterator {
for (key, value) in iterator {
result.set(key, value);
}
+3 -5
View File
@@ -68,9 +68,7 @@ impl Audio {
#[inline]
pub fn set_channel_layout(&mut self, value: ChannelLayout) {
unsafe {
(*self.as_mut_ptr()).channel_layout = value.bits() as u64;
}
unsafe { (*self.as_mut_ptr()).channel_layout = value.bits() }
}
#[inline]
@@ -140,7 +138,7 @@ impl Audio {
panic!("out of bounds");
}
if !<T as Sample>::is_valid(self.format(), self.channels() as u16) {
if !<T as Sample>::is_valid(self.format(), self.channels()) {
panic!("unsupported type");
}
@@ -153,7 +151,7 @@ impl Audio {
panic!("out of bounds");
}
if !<T as Sample>::is_valid(self.format(), self.channels() as u16) {
if !<T as Sample>::is_valid(self.format(), self.channels()) {
panic!("unsupported type");
}
+4 -4
View File
@@ -79,8 +79,8 @@ impl Frame {
pub fn packet(&self) -> Packet {
unsafe {
Packet {
duration: (*self.as_ptr()).pkt_duration as i64,
position: (*self.as_ptr()).pkt_pos as i64,
duration: (*self.as_ptr()).pkt_duration,
position: (*self.as_ptr()).pkt_pos,
size: (*self.as_ptr()).pkt_size as usize,
#[cfg(not(feature = "ffmpeg_5_0"))]
@@ -95,7 +95,7 @@ impl Frame {
unsafe {
match (*self.as_ptr()).pts {
AV_NOPTS_VALUE => None,
pts => Some(pts as i64),
pts => Some(pts),
}
}
}
@@ -112,7 +112,7 @@ impl Frame {
unsafe {
match (*self.as_ptr()).best_effort_timestamp {
AV_NOPTS_VALUE => None,
t => Some(t as i64),
t => Some(t),
}
}
}
+4 -1
View File
@@ -213,7 +213,10 @@ impl<'a> SideData<'a> {
#[inline]
pub fn data(&self) -> &[u8] {
unsafe { slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size as usize) }
#[allow(clippy::unnecessary_cast)]
unsafe {
slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size as usize)
}
}
#[inline]
+2 -2
View File
@@ -3,12 +3,12 @@ use Error;
#[inline(always)]
pub fn current() -> i64 {
unsafe { av_gettime() as i64 }
unsafe { av_gettime() }
}
#[inline(always)]
pub fn relative() -> i64 {
unsafe { av_gettime_relative() as i64 }
unsafe { av_gettime_relative() }
}
#[inline(always)]