Skip to content

Commit f3b8209

Browse files
committed
Fix a couple of Nightly clippy warnings.
1 parent 633279a commit f3b8209

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

mp4parse/src/lib.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ impl<'a, T> OffsetReader<'a, T> {
128128
}
129129
}
130130

131-
impl<'a, T> Offset for OffsetReader<'a, T> {
131+
impl<T> Offset for OffsetReader<'_, T> {
132132
fn offset(&self) -> u64 {
133133
self.offset
134134
}
135135
}
136136

137-
impl<'a, T: Read> Read for OffsetReader<'a, T> {
137+
impl<T: Read> Read for OffsetReader<'_, T> {
138138
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
139139
let bytes_read = self.reader.read(buf)?;
140140
trace!("Read {} bytes at offset {}", bytes_read, self.offset);
@@ -2138,7 +2138,7 @@ struct BoxIter<'a, T: 'a> {
21382138
src: &'a mut T,
21392139
}
21402140

2141-
impl<'a, T: Read> BoxIter<'a, T> {
2141+
impl<T: Read> BoxIter<'_, T> {
21422142
fn new(src: &mut T) -> BoxIter<T> {
21432143
BoxIter { src }
21442144
}
@@ -2156,19 +2156,19 @@ impl<'a, T: Read> BoxIter<'a, T> {
21562156
}
21572157
}
21582158

2159-
impl<'a, T: Read> Read for BMFFBox<'a, T> {
2159+
impl<T: Read> Read for BMFFBox<'_, T> {
21602160
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
21612161
self.content.read(buf)
21622162
}
21632163
}
21642164

2165-
impl<'a, T: Read> TryRead for BMFFBox<'a, T> {
2165+
impl<T: Read> TryRead for BMFFBox<'_, T> {
21662166
fn try_read_to_end(&mut self, buf: &mut TryVec<u8>) -> std::io::Result<usize> {
21672167
fallible_collections::try_read_up_to(self, self.bytes_left(), buf)
21682168
}
21692169
}
21702170

2171-
impl<'a, T: Offset> Offset for BMFFBox<'a, T> {
2171+
impl<T: Offset> Offset for BMFFBox<'_, T> {
21722172
fn offset(&self) -> u64 {
21732173
self.content.get_ref().offset()
21742174
}
@@ -2183,12 +2183,12 @@ impl<'a, T: Read> BMFFBox<'a, T> {
21832183
&self.head
21842184
}
21852185

2186-
fn box_iter<'b>(&'b mut self) -> BoxIter<BMFFBox<'a, T>> {
2186+
fn box_iter(&mut self) -> BoxIter<BMFFBox<'a, T>> {
21872187
BoxIter::new(self)
21882188
}
21892189
}
21902190

2191-
impl<'a, T> Drop for BMFFBox<'a, T> {
2191+
impl<T> Drop for BMFFBox<'_, T> {
21922192
fn drop(&mut self) {
21932193
if self.content.limit() > 0 {
21942194
let name: FourCC = From::from(self.head.name);
@@ -2206,10 +2206,7 @@ impl<'a, T> Drop for BMFFBox<'a, T> {
22062206
///
22072207
/// See ISOBMFF (ISO 14496-12:2020) § 4.2
22082208
fn read_box_header<T: ReadBytesExt>(src: &mut T) -> Result<BoxHeader> {
2209-
let size32 = match be_u32(src) {
2210-
Ok(v) => v,
2211-
Err(error) => return Err(error),
2212-
};
2209+
let size32 = be_u32(src)?;
22132210
let name = BoxType::from(be_u32(src)?);
22142211
let size = match size32 {
22152212
// valid only for top-level box and indicates it's the last box in the file. usually mdat.
@@ -2484,7 +2481,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
24842481
return Status::MultipleAlpha.into();
24852482
}
24862483

2487-
let premultiplied_alpha = alpha_item_id.map_or(false, |alpha_item_id| {
2484+
let premultiplied_alpha = alpha_item_id.is_some_and(|alpha_item_id| {
24882485
item_references.iter().any(|iref| {
24892486
iref.from_item_id == primary_item_id
24902487
&& iref.to_item_id == alpha_item_id
@@ -2623,7 +2620,7 @@ pub fn read_avif<T: Read>(f: &mut T, strictness: ParseStrictness) -> Result<Avif
26232620

26242621
// Returns true iff `id` is `Some` and there is no corresponding property for it
26252622
let missing_property_for = |id: Option<ItemId>, property: BoxType| -> bool {
2626-
id.map_or(false, |id| {
2623+
id.is_some_and(|id| {
26272624
item_properties
26282625
.get(id, property)
26292626
.map_or(true, |opt| opt.is_none())

mp4parse/src/unstable.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ struct TimeOffsetIterator<'a> {
285285
track_id: usize,
286286
}
287287

288-
impl<'a> Iterator for TimeOffsetIterator<'a> {
288+
impl Iterator for TimeOffsetIterator<'_> {
289289
type Item = i64;
290290

291291
#[allow(clippy::reversed_empty_ranges)]
@@ -320,7 +320,7 @@ impl<'a> Iterator for TimeOffsetIterator<'a> {
320320
}
321321
}
322322

323-
impl<'a> TimeOffsetIterator<'a> {
323+
impl TimeOffsetIterator<'_> {
324324
fn next_offset_time(&mut self) -> TrackScaledTime<i64> {
325325
match self.next() {
326326
Some(v) => TrackScaledTime::<i64>(v, self.track_id),
@@ -342,7 +342,7 @@ struct TimeToSampleIterator<'a> {
342342
track_id: usize,
343343
}
344344

345-
impl<'a> Iterator for TimeToSampleIterator<'a> {
345+
impl Iterator for TimeToSampleIterator<'_> {
346346
type Item = u32;
347347

348348
#[allow(clippy::reversed_empty_ranges)]
@@ -363,7 +363,7 @@ impl<'a> Iterator for TimeToSampleIterator<'a> {
363363
}
364364
}
365365

366-
impl<'a> TimeToSampleIterator<'a> {
366+
impl TimeToSampleIterator<'_> {
367367
fn next_delta(&mut self) -> TrackScaledTime<i64> {
368368
match self.next() {
369369
Some(v) => TrackScaledTime::<i64>(i64::from(v), self.track_id),
@@ -405,7 +405,7 @@ struct SampleToChunkIterator<'a> {
405405
remain_chunk_count: u32, // total chunk number from 'stco'.
406406
}
407407

408-
impl<'a> Iterator for SampleToChunkIterator<'a> {
408+
impl Iterator for SampleToChunkIterator<'_> {
409409
type Item = (u32, u32);
410410

411411
fn next(&mut self) -> Option<(u32, u32)> {
@@ -428,7 +428,7 @@ impl<'a> Iterator for SampleToChunkIterator<'a> {
428428
}
429429
}
430430

431-
impl<'a> SampleToChunkIterator<'a> {
431+
impl SampleToChunkIterator<'_> {
432432
#[allow(clippy::reversed_empty_ranges)]
433433
fn locate(&mut self) -> std::ops::Range<u32> {
434434
loop {

mp4parse_capi/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,6 @@ fn get_indice_table(
14161416
/// info raw pointers passed to it. Callers should ensure the parser
14171417
/// pointer points to a valid `Mp4parseParser` and that the info pointer points
14181418
/// to a valid `Mp4parseFragmentInfo`.
1419-
14201419
#[no_mangle]
14211420
pub unsafe extern "C" fn mp4parse_get_fragment_info(
14221421
parser: *mut Mp4parseParser,

0 commit comments

Comments
 (0)