Run cargo clippy on whole project (#322)
* Run cargo clippy on plume-common Run clippy on plume-common and adjuste code accordingly * Run cargo clippy on plume-model Run clippy on plume-model and adjuste code accordingly * Reduce need for allocation in plume-common * Reduce need for allocation in plume-model add a quick compilation failure if no database backend is enabled * Run cargo clippy on plume-cli * Run cargo clippy on plume
This commit is contained in:
@@ -42,7 +42,7 @@ pub struct NewApiToken {
|
||||
impl ApiToken {
|
||||
get!(api_tokens);
|
||||
insert!(api_tokens, NewApiToken);
|
||||
find_by!(api_tokens, find_by_value, value as String);
|
||||
find_by!(api_tokens, find_by_value, value as &str);
|
||||
|
||||
pub fn can(&self, what: &'static str, scope: &'static str) -> bool {
|
||||
let full_scope = what.to_owned() + ":" + scope;
|
||||
@@ -78,11 +78,11 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApiToken {
|
||||
|
||||
if auth_type == "Bearer" {
|
||||
let conn = request.guard::<DbConn>().expect("Couldn't connect to DB");
|
||||
if let Some(token) = ApiToken::find_by_value(&*conn, val.to_string()) {
|
||||
if let Some(token) = ApiToken::find_by_value(&*conn, val) {
|
||||
return Outcome::Success(token);
|
||||
}
|
||||
}
|
||||
|
||||
return Outcome::Forward(());
|
||||
Outcome::Forward(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user