Skip to content

misc: clippy fixes #514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ redundant_guards = "allow" # Currently broken for some cases, might enabl
into_iter_without_iter = "allow" # This is only going to fire on some internal types, doesn't matter much
struct_excessive_bools = "allow" # I have yet to find one case of this being useful
needless_continue = "allow" # All occurences of this lint are just for clarity in large loops
unbuffered_bytes = "allow" # It is up to the caller to wrap their data in `BufReader`s

[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/ape/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ where
properties.bit_depth = 24
} else {
properties.bit_depth = 16
};
}

let blocks_per_frame = match version {
_ if version >= 3950 => 73728 * 4,
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/ape/tag/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl ApeTag {
self.insert(item);
}
},
};
}
}

fn split_num_pair(&self, key: &str) -> (Option<u32>, Option<u32>) {
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/ape/tag/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ where
)?;
} else {
tag = create_ape_tag(tag_ref, std::iter::empty(), write_options)?;
};
}

file.rewind()?;

Expand Down
2 changes: 1 addition & 1 deletion lofty/src/id3/v2/frame/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<'a> TryFrom<&'a TagItem> for FrameRef<'a> {
)?);
},
(_, item_value) => value = frame_from_unknown_item(id, item_value.clone())?,
};
}
},
Err(_) => {
let item_key = tag_item.key();
Expand Down
4 changes: 2 additions & 2 deletions lofty/src/id3/v2/items/attached_picture_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl AttachedPictureFrame<'_> {
)?
.text_or_none();
mime_type = mime_type_str.map(|mime_type_str| MimeType::from_str(&mime_type_str));
};
}

let pic_type = PictureType::from_u8(reader.read_u8()?);

Expand Down Expand Up @@ -168,7 +168,7 @@ impl AttachedPictureFrame<'_> {
data.write_all(mime_type.as_str().as_bytes())?;
}
data.write_u8(0)?;
};
}

data.write_u8(self.picture.pic_type.as_u8())?;

Expand Down
2 changes: 1 addition & 1 deletion lofty/src/id3/v2/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
tag_bytes = unsynchronized_reader.into_inner();
} else {
ret = read_all_frames_into_tag(&mut tag_bytes, header, parse_options)?;
};
}

// Throw away the rest of the tag (padding, bad frames)
std::io::copy(&mut tag_bytes, &mut std::io::sink())?;
Expand Down
4 changes: 2 additions & 2 deletions lofty/src/id3/v2/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ impl Id3v2Tag {
}
}
},
};
}
}

/// Returns all genres contained in a `TCON` frame.
Expand Down Expand Up @@ -806,7 +806,7 @@ impl Accessor for Id3v2Tag {

if genres.peek().is_none() {
return Some(Cow::Borrowed(first));
};
}

let mut joined = String::from(first);
for genre in genres {
Expand Down
4 changes: 2 additions & 2 deletions lofty/src/id3/v2/write/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ where
new_genre_string.push_str(genre);
},
_ => {
new_genre_string.push_str(&format!("({genre})"));
new_genre_string = format!("{new_genre_string}({genre})");
},
}
}
Expand Down Expand Up @@ -197,7 +197,7 @@ where
ipls_frame.value.push('\0');
}

ipls_frame.value.push_str(&format!("{}\0{}", key, value));
ipls_frame.value = format!("{}{key}\0{value}", ipls_frame.value);
}

continue;
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/iff/aiff/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ where
}
} else {
properties = AiffProperties::default();
};
}

Ok(AiffFile {
properties,
Expand Down
4 changes: 2 additions & 2 deletions lofty/src/iff/wav/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub(super) fn read_properties(
}) if valid_bits_per_sample > 0 => bit_depth = valid_bits_per_sample as u8,
_ if bits_per_sample > 0 => bit_depth = bits_per_sample as u8,
_ => bit_depth = bytes_per_sample.saturating_mul(8) as u8,
};
}

let channel_mask = extensible_info.map(|info| info.channel_mask);

Expand Down Expand Up @@ -252,7 +252,7 @@ pub(super) fn read_properties(
}
} else {
log::warn!("Unable to calculate duration and bitrate");
};
}

Ok(WavProperties {
format: match format_tag {
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/mp4/ilst/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ where
AtomData::UnsignedInteger(uint) => write_unsigned_int(*uint, writer)?,
AtomData::Bool(b) => write_bool(*b, writer)?,
AtomData::Unknown { code, data } => write_data(*code, data, writer)?,
};
}
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/ogg/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ where
Err(_) => decode_err!(@BAIL "OGG: File has an invalid vendor string"),
}
},
};
}

let number_of_items = data.read_u32::<LittleEndian>()?;
if number_of_items > (len >> 2) as u32 {
Expand Down
2 changes: 1 addition & 1 deletion lofty/src/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl Picture {
///
/// * This is for reading picture data only, from a [`File`](std::fs::File) for example.
/// * `pic_type` will always be [`PictureType::Other`], be sure to change it accordingly if
/// writing.
/// writing.
///
/// # Errors
///
Expand Down
2 changes: 1 addition & 1 deletion ogg_pager/src/packets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl Packets {
byte_count_to_read = packet_size;
*packet_bytes_already_read = Some(packet_size);
},
};
}

byte_count_to_read
}
Expand Down