Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA committed Jul 20, 2023
1 parent 18d6efb commit 4a60c1c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/id3/v2/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl FrameValue {
FrameValue::RelativeVolumeAdjustment(frame) => frame.as_bytes(),
FrameValue::UniqueFileIdentifier(frame) => frame.as_bytes(),
FrameValue::Ownership(frame) => frame.as_bytes()?,
FrameValue::EventTimingCodes(frame) => frame.as_bytes()?,
FrameValue::EventTimingCodes(frame) => frame.as_bytes(),
FrameValue::Private(frame) => frame.as_bytes(),
FrameValue::Binary(binary) => binary.clone(),
})
Expand Down
6 changes: 3 additions & 3 deletions src/id3/v2/items/event_timing_codes_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl EventTimingCodesFrame {
/// Convert an [`EventTimingCodesFrame`] to a byte vec
///
/// NOTE: This will sort all events according to their timestamps
pub fn as_bytes(&self) -> Result<Vec<u8>> {
pub fn as_bytes(&self) -> Vec<u8> {
let mut content = vec![self.timestamp_format as u8];

let mut sorted_events = Vec::from_iter(self.events.iter());
Expand All @@ -234,7 +234,7 @@ impl EventTimingCodesFrame {
content.extend(event.timestamp.to_be_bytes())
}

Ok(content)
content
}
}

Expand Down Expand Up @@ -283,7 +283,7 @@ mod tests {

#[test]
fn etco_encode() {
let encoded = expected().as_bytes().unwrap();
let encoded = expected().as_bytes();

let expected_bytes =
crate::tag::utils::test_utils::read_path("tests/tags/assets/id3v2/test.etco");
Expand Down
5 changes: 5 additions & 0 deletions src/id3/v2/items/ownership_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ impl OwnershipFrame {
/// Read an [`OwnershipFrame`]
///
/// NOTE: This expects the frame header to have already been skipped
///
/// # Errors
///
/// * Invalid text encoding
/// * Not enough data
pub fn parse<R>(reader: &mut R) -> Result<Option<Self>>
where
R: Read,
Expand Down
4 changes: 4 additions & 0 deletions src/id3/v2/items/private_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ impl PrivateFrame {
/// Read an [`PrivateFrame`]
///
/// NOTE: This expects the frame header to have already been skipped
///
/// # Errors
///
/// * Failure to read from `reader`
pub fn parse<R>(reader: &mut R) -> Result<Option<Self>>
where
R: Read,
Expand Down
9 changes: 7 additions & 2 deletions src/id3/v2/items/relative_volume_adjustment_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ impl RelativeVolumeAdjustmentFrame {
/// Read an [`RelativeVolumeAdjustmentFrame`]
///
/// NOTE: This expects the frame header to have already been skipped
///
/// # Errors
///
/// * Bad channel type (See [Id3v2ErrorKind::BadRva2ChannelType])
/// * Not enough data
pub fn parse<R>(reader: &mut R, parse_mode: ParsingMode) -> Result<Option<Self>>
where
R: Read,
Expand Down Expand Up @@ -156,11 +161,11 @@ impl RelativeVolumeAdjustmentFrame {
true,
));

for (_, info) in &self.channels {
for (channel_type, info) in &self.channels {
let mut bits_representing_peak = info.bits_representing_peak;
let expected_peak_byte_length = (bits_representing_peak + 7) >> 3;

content.push(info.channel_type as u8);
content.push(*channel_type as u8);
content.extend(info.volume_adjustment.to_be_bytes());

if info.peak_volume.is_none() {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
clippy::field_reassign_with_default,
clippy::manual_range_patterns, /* This is not at all clearer as it suggests */
clippy::explicit_iter_loop,
clippy::from_iter_instead_of_collect
)]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

Expand Down

0 comments on commit 4a60c1c

Please sign in to comment.