Format and clean up code.

This commit is contained in:
Paul Makles
2020-04-09 18:43:23 +01:00
parent 8a4a386ec5
commit 83f1fbe747
5 changed files with 41 additions and 42 deletions

View File

@@ -133,7 +133,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for User {
0 => Outcome::Failure((Status::Forbidden, AuthError::Missing)),
1 => {
let key = keys[0];
let col = database::get_db().collection("users");
let col = database::get_collection("users");
let result = col.find_one(doc! { "access_token": key }, None).unwrap();
if let Some(user) = result {
@@ -165,7 +165,7 @@ impl<'r> FromParam<'r> for User {
type Error = &'r RawStr;
fn from_param(param: &'r RawStr) -> Result<Self, Self::Error> {
let col = database::get_db().collection("users");
let col = database::get_collection("users");
let result = col
.find_one(doc! { "_id": param.to_string() }, None)
.unwrap();