fixed borrow/moving issue with create_channel call

removed some unsed variables
This commit is contained in:
shockrah 2020-06-03 00:14:45 -07:00
parent 7fa103b1dc
commit 50962598e5

View File

@ -162,7 +162,7 @@ fn parse_insert_channel_params(name: Option<&&str>, kind: Option<&&str>, desc: O
}
async fn insert_channel(pool: &Pool, channel: InsertableChannel) -> Result<(), Error> {
let conn = pool.get_conn().await?;
let conn = conn.batch_exec(
conn.batch_exec(
r"INSERT INTO channels (name, kind, description) VALUES (:name, :kind, :description)",
params!{
"name" => channel.name,
@ -172,7 +172,7 @@ async fn insert_channel(pool: &Pool, channel: InsertableChannel) -> Result<(), E
Ok(())
}
pub async fn create_channel(pool: &Pool, response: &Response<Body>, params: HashMap<&str, &str>) {
pub async fn create_channel(pool: &Pool, response: &mut Response<Body>, params: &HashMap<&str, &str>) {
/*
* Create a channel base on a few parameters that may or may not be there
*/
@ -187,6 +187,6 @@ pub async fn create_channel(pool: &Pool, response: &Response<Body>, params: Hash
Err(_) => *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR
}
},
Err(e) => *response.status_mut() = StatusCode::BAD_REQUEST
Err(_) => *response.status_mut() = StatusCode::BAD_REQUEST
}
}