Fixed compiler warnings

This commit is contained in:
Antoine Gersant 2017-09-26 23:15:44 -07:00
parent 6ae9f6b6a0
commit ce4f9ef87f
2 changed files with 12 additions and 13 deletions

View file

@ -575,7 +575,7 @@ fn read_playlist(request: &mut Request, db: &DB) -> IronResult<Response> {
let playlist_name = match percent_decode(playlist_name.as_bytes()).decode_utf8() {
Ok(s) => s,
Err(e) => return Err(Error::from(ErrorKind::EncodingError).into()),
Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()),
};
let songs = playlist::read_playlist(&playlist_name, &username, db)?;
@ -602,7 +602,7 @@ fn delete_playlist(request: &mut Request, db: &DB) -> IronResult<Response> {
let playlist_name = match percent_decode(playlist_name.as_bytes()).decode_utf8() {
Ok(s) => s,
Err(e) => return Err(Error::from(ErrorKind::EncodingError).into()),
Err(_) => return Err(Error::from(ErrorKind::EncodingError).into()),
};
playlist::delete_playlist(&playlist_name, &username, db)?;

View file

@ -31,7 +31,6 @@ pub struct User {
pub struct Playlist {
id: i32,
owner: i32,
name: String,
}
#[derive(Identifiable, Queryable, Associations)]
@ -39,8 +38,6 @@ pub struct Playlist {
pub struct PlaylistSong {
id: i32,
playlist: i32,
path: String,
ordering: i32,
}
#[derive(Insertable)]
@ -111,6 +108,7 @@ pub fn save_playlist<T>(playlist_name: &str,
{
use self::playlists::dsl::*;
playlist = playlists
.select((id, owner))
.filter(name.eq(playlist_name).and(owner.eq(user.id)))
.get_result(connection.deref())?;
}
@ -176,6 +174,7 @@ pub fn read_playlist<T>(playlist_name: &str, owner: &str, db: &T) -> Result<Vec<
{
use self::playlists::dsl::*;
playlist = playlists
.select((id, owner))
.filter(name.eq(playlist_name).and(owner.eq(user.id)))
.get_result(connection.deref())?;
}