mirror of
https://github.com/agersant/polaris
synced 2024-11-10 02:04:13 +00:00
Apply lints
This commit is contained in:
parent
608dabb789
commit
4807b2d3b9
5 changed files with 9 additions and 13 deletions
|
@ -56,7 +56,6 @@ impl From<id3::Tag> for SongTags {
|
|||
let track_number = tag.track();
|
||||
let year = tag
|
||||
.year()
|
||||
.map(|y| y as i32)
|
||||
.or_else(|| tag.date_released().map(|d| d.year))
|
||||
.or_else(|| tag.original_date_released().map(|d| d.year))
|
||||
.or_else(|| tag.date_recorded().map(|d| d.year));
|
||||
|
@ -316,9 +315,7 @@ fn read_flac(path: &Path) -> Result<SongTags, Error> {
|
|||
let year = vorbis.get("DATE").and_then(|d| d[0].parse::<i32>().ok());
|
||||
let mut streaminfo = tag.get_blocks(metaflac::BlockType::StreamInfo);
|
||||
let duration = match streaminfo.next() {
|
||||
Some(&metaflac::Block::StreamInfo(ref s)) => {
|
||||
Some((s.total_samples as u32 / s.sample_rate) as u32)
|
||||
}
|
||||
Some(metaflac::Block::StreamInfo(s)) => Some(s.total_samples as u32 / s.sample_rate),
|
||||
_ => None,
|
||||
};
|
||||
let has_artwork = tag.pictures().count() > 0;
|
||||
|
|
|
@ -34,7 +34,7 @@ fn update_removes_missing_content() {
|
|||
|
||||
let copy_options = fs_extra::dir::CopyOptions::new();
|
||||
fs_extra::dir::copy(
|
||||
&original_collection_dir,
|
||||
original_collection_dir,
|
||||
&builder.test_directory,
|
||||
©_options,
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ fn update_removes_missing_content() {
|
|||
}
|
||||
|
||||
let khemmis_directory = test_collection_dir.join("Khemmis");
|
||||
std::fs::remove_dir_all(&khemmis_directory).unwrap();
|
||||
std::fs::remove_dir_all(khemmis_directory).unwrap();
|
||||
ctx.index.update().unwrap();
|
||||
{
|
||||
let mut connection = ctx.db.connect().unwrap();
|
||||
|
@ -124,7 +124,7 @@ fn can_flatten_directory() {
|
|||
.build();
|
||||
ctx.index.update().unwrap();
|
||||
let path: PathBuf = [TEST_MOUNT_NAME, "Tobokegao"].iter().collect();
|
||||
let songs = ctx.index.flatten(&path).unwrap();
|
||||
let songs = ctx.index.flatten(path).unwrap();
|
||||
assert_eq!(songs.len(), 8);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ fn can_flatten_directory_with_shared_prefix() {
|
|||
.build();
|
||||
ctx.index.update().unwrap();
|
||||
let path: PathBuf = [TEST_MOUNT_NAME, "Tobokegao", "Picnic"].iter().collect(); // Prefix of '(Picnic Remixes)'
|
||||
let songs = ctx.index.flatten(&path).unwrap();
|
||||
let songs = ctx.index.flatten(path).unwrap();
|
||||
assert_eq!(songs.len(), 7);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ impl Manager {
|
|||
|
||||
if let Some(sleep_duration) = new_settings.reindex_every_n_seconds {
|
||||
diesel::update(misc_settings::table)
|
||||
.set(misc_settings::index_sleep_duration_seconds.eq(sleep_duration as i32))
|
||||
.set(misc_settings::index_sleep_duration_seconds.eq(sleep_duration))
|
||||
.execute(&mut connection)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ pub struct ContextBuilder {
|
|||
impl ContextBuilder {
|
||||
pub fn new(test_name: String) -> Self {
|
||||
Self {
|
||||
test_directory: prepare_test_directory(&test_name),
|
||||
test_directory: prepare_test_directory(test_name),
|
||||
config: config::Config::default(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -531,7 +531,7 @@ async fn get_audio(
|
|||
})
|
||||
.await?;
|
||||
|
||||
let named_file = NamedFile::open(&audio_path).map_err(|_| APIError::AudioFileIOError)?;
|
||||
let named_file = NamedFile::open(audio_path).map_err(|_| APIError::AudioFileIOError)?;
|
||||
Ok(MediaFile::new(named_file))
|
||||
}
|
||||
|
||||
|
@ -555,8 +555,7 @@ async fn get_thumbnail(
|
|||
})
|
||||
.await?;
|
||||
|
||||
let named_file =
|
||||
NamedFile::open(&thumbnail_path).map_err(|_| APIError::ThumbnailFileIOError)?;
|
||||
let named_file = NamedFile::open(thumbnail_path).map_err(|_| APIError::ThumbnailFileIOError)?;
|
||||
|
||||
Ok(MediaFile::new(named_file))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue