Linter suggestions
This commit is contained in:
parent
63e971059a
commit
a5f5a77100
3 changed files with 6 additions and 6 deletions
|
@ -103,7 +103,7 @@ impl FrameContent for id3::Tag {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_mp3(path: &Path) -> Result<SongTags> {
|
fn read_mp3(path: &Path) -> Result<SongTags> {
|
||||||
let tag = id3::Tag::read_from_path(&path).or_else(|error| {
|
let tag = id3::Tag::read_from_path(path).or_else(|error| {
|
||||||
if let Some(tag) = error.partial_tag {
|
if let Some(tag) = error.partial_tag {
|
||||||
Ok(tag)
|
Ok(tag)
|
||||||
} else {
|
} else {
|
||||||
|
@ -112,7 +112,7 @@ fn read_mp3(path: &Path) -> Result<SongTags> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let duration = {
|
let duration = {
|
||||||
mp3_duration::from_path(&path)
|
mp3_duration::from_path(path)
|
||||||
.map(|d| d.as_secs() as u32)
|
.map(|d| d.as_secs() as u32)
|
||||||
.ok()
|
.ok()
|
||||||
};
|
};
|
||||||
|
@ -123,7 +123,7 @@ fn read_mp3(path: &Path) -> Result<SongTags> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_aiff(path: &Path) -> Result<SongTags> {
|
fn read_aiff(path: &Path) -> Result<SongTags> {
|
||||||
let tag = id3::Tag::read_from_aiff_path(&path).or_else(|error| {
|
let tag = id3::Tag::read_from_aiff_path(path).or_else(|error| {
|
||||||
if let Some(tag) = error.partial_tag {
|
if let Some(tag) = error.partial_tag {
|
||||||
Ok(tag)
|
Ok(tag)
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,7 +134,7 @@ fn read_aiff(path: &Path) -> Result<SongTags> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_wave(path: &Path) -> Result<SongTags> {
|
fn read_wave(path: &Path) -> Result<SongTags> {
|
||||||
let tag = id3::Tag::read_from_wav_path(&path).or_else(|error| {
|
let tag = id3::Tag::read_from_wav_path(path).or_else(|error| {
|
||||||
if let Some(tag) = error.partial_tag {
|
if let Some(tag) = error.partial_tag {
|
||||||
Ok(tag)
|
Ok(tag)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl Index {
|
||||||
let vfs = self.vfs_manager.get_vfs()?;
|
let vfs = self.vfs_manager.get_vfs()?;
|
||||||
let mut connection = self.db.connect()?;
|
let mut connection = self.db.connect()?;
|
||||||
|
|
||||||
let real_songs: Vec<Song> = if virtual_path.as_ref().parent() != None {
|
let real_songs: Vec<Song> = if virtual_path.as_ref().parent().is_some() {
|
||||||
let real_path = vfs
|
let real_path = vfs
|
||||||
.virtual_to_real(virtual_path)
|
.virtual_to_real(virtual_path)
|
||||||
.map_err(|_| QueryError::VFSPathNotFound)?;
|
.map_err(|_| QueryError::VFSPathNotFound)?;
|
||||||
|
|
|
@ -40,7 +40,7 @@ impl diesel::r2d2::CustomizeConnection<SqliteConnection, diesel::r2d2::Error>
|
||||||
|
|
||||||
impl DB {
|
impl DB {
|
||||||
pub fn new(path: &Path) -> Result<DB> {
|
pub fn new(path: &Path) -> Result<DB> {
|
||||||
std::fs::create_dir_all(&path.parent().unwrap())?;
|
std::fs::create_dir_all(path.parent().unwrap())?;
|
||||||
let manager = ConnectionManager::<SqliteConnection>::new(path.to_string_lossy());
|
let manager = ConnectionManager::<SqliteConnection>::new(path.to_string_lossy());
|
||||||
let pool = diesel::r2d2::Pool::builder()
|
let pool = diesel::r2d2::Pool::builder()
|
||||||
.connection_customizer(Box::new(ConnectionCustomizer {}))
|
.connection_customizer(Box::new(ConnectionCustomizer {}))
|
||||||
|
|
Loading…
Add table
Reference in a new issue