From 13c5ff9938c3a68d3abd37bab136636269b71ad4 Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:15:13 -0400 Subject: [PATCH] misc: Clippy --- lofty/src/ebml/element_reader.rs | 8 ++++---- lofty/src/ebml/read/segment_cluster.rs | 12 ++++++------ lofty/src/properties/tests.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lofty/src/ebml/element_reader.rs b/lofty/src/ebml/element_reader.rs index 1bf0a870..870ba578 100644 --- a/lofty/src/ebml/element_reader.rs +++ b/lofty/src/ebml/element_reader.rs @@ -746,7 +746,7 @@ where } } -impl<'a, R> Read for ElementChildIterator<'a, R> +impl Read for ElementChildIterator<'_, R> where R: Read, { @@ -755,7 +755,7 @@ where } } -impl<'a, R> Deref for ElementChildIterator<'a, R> +impl Deref for ElementChildIterator<'_, R> where R: Read, { @@ -766,7 +766,7 @@ where } } -impl<'a, R> DerefMut for ElementChildIterator<'a, R> +impl DerefMut for ElementChildIterator<'_, R> where R: Read, { @@ -775,7 +775,7 @@ where } } -impl<'a, R> Drop for ElementChildIterator<'a, R> +impl Drop for ElementChildIterator<'_, R> where R: Read, { diff --git a/lofty/src/ebml/read/segment_cluster.rs b/lofty/src/ebml/read/segment_cluster.rs index d82853a9..dea193f7 100644 --- a/lofty/src/ebml/read/segment_cluster.rs +++ b/lofty/src/ebml/read/segment_cluster.rs @@ -3,7 +3,7 @@ use crate::ebml::element_reader::{ ChildElementDescriptor, ElementChildIterator, ElementIdent, ElementReaderYield, }; use crate::ebml::properties::EbmlProperties; -use crate::ebml::{AudioTrackDescriptor, VInt}; +use crate::ebml::VInt; use crate::error::Result; use std::io::{Read, Seek}; @@ -69,7 +69,7 @@ where continue; } - total_audio_data_size += (size.value() - header_size as u64); + total_audio_data_size += (size.value() - u64::from(header_size)); }, ElementIdent::BlockGroup => read_block_group( &mut children_reader.children(), @@ -87,7 +87,7 @@ where return Ok(()); } - let duration_millis = properties.duration().as_secs() as u128; + let duration_millis = u128::from(properties.duration().as_secs()); if duration_millis == 0 { log::warn!("Duration is zero, cannot calculate bitrate"); return Ok(()); @@ -95,7 +95,7 @@ where let default_audio_track = &mut properties.audio_tracks[default_audio_track_position]; // TODO - let bitrate_bps = (((total_audio_data_size as u128) * 8) / duration_millis) as u32; + let bitrate_bps = ((u128::from(total_audio_data_size) * 8) / duration_millis) as u32; default_audio_track.settings.bitrate = Some(bitrate_bps / 1000); Ok(()) @@ -144,7 +144,7 @@ where continue; } - *total_audio_data_size += (size.value() - header_size as u64); + *total_audio_data_size += (size.value() - u64::from(header_size)); } Ok(()) @@ -166,7 +166,7 @@ where let track_number = VInt::::parse(children_reader, max_size_length)?; let track_number_octets = track_number.octet_length(); - children_reader.skip(block_size - track_number_octets as u64)?; + children_reader.skip(block_size - u64::from(track_number_octets))?; if track_number != target_track_number { return Ok((false, track_number_octets + NON_VARIABLE_BLOCK_HEADER_SIZE)); } diff --git a/lofty/src/properties/tests.rs b/lofty/src/properties/tests.rs index a458665e..120194e3 100644 --- a/lofty/src/properties/tests.rs +++ b/lofty/src/properties/tests.rs @@ -85,14 +85,14 @@ fn MKA_PROPERTIES() -> EbmlProperties { }, extensions: Vec::new(), segment_info: SegmentInfo { - timestamp_scale: 1000000, + timestamp_scale: 1_000_000, muxing_app: String::from("Lavf60.3.100"), writing_app: String::from("Lavf60.3.100"), duration: Some(Duration::from_millis(1431)), }, audio_tracks: vec![AudioTrackDescriptor { number: 1, - uid: 18181673715630629642, + uid: 18_181_673_715_630_629_642, enabled: true, default: false, language: Language::Iso639_2(String::from("und")),