Fix cargo clippy issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2023-07-26 08:54:13 +02:00
parent 393f733276
commit b0935f3b23

View File

@ -17,7 +17,7 @@ use image::DynamicImage;
/// Tags get written as ID3v2.3. /// Tags get written as ID3v2.3.
/// ///
pub fn embed_image(music_filename: &Path, image_filename: &Path) -> anyhow::Result<()> { pub fn embed_image(music_filename: &Path, image_filename: &Path) -> anyhow::Result<()> {
let image = image::open(&image_filename) let image = image::open(image_filename)
.map_err(|e| anyhow!("Error reading image {:?}: {}", image_filename, e))?; .map_err(|e| anyhow!("Error reading image {:?}: {}", image_filename, e))?;
embed_image_from_memory(music_filename, &image) embed_image_from_memory(music_filename, &image)
@ -68,7 +68,7 @@ pub fn embed_image_from_memory(
/// ///
pub fn extract_first_image(music_filename: &Path, image_filename: &Path) -> anyhow::Result<()> { pub fn extract_first_image(music_filename: &Path, image_filename: &Path) -> anyhow::Result<()> {
extract_first_image_as_img(music_filename)? extract_first_image_as_img(music_filename)?
.save(&image_filename) .save(image_filename)
.map_err(|e| anyhow!("Couldn't write image file {:?}: {}", image_filename, e)) .map_err(|e| anyhow!("Couldn't write image file {:?}: {}", image_filename, e))
} }
@ -104,7 +104,7 @@ pub fn remove_images(music_filename: &Path) -> anyhow::Result<()> {
} }
fn read_tag(path: &Path) -> anyhow::Result<id3::Tag> { fn read_tag(path: &Path) -> anyhow::Result<id3::Tag> {
id3::Tag::read_from_path(&path).or_else(|e| { id3::Tag::read_from_path(path).or_else(|e| {
eprintln!( eprintln!(
"Warning: file metadata is corrupted, trying to read partial tag: {}", "Warning: file metadata is corrupted, trying to read partial tag: {}",
path.display() path.display()