From bd2f718412348eb0926384d6a070c68a7bd3fcd4 Mon Sep 17 00:00:00 2001 From: Ihor M Date: Fri, 20 Nov 2020 15:54:23 +0100 Subject: [PATCH] clippy - refactoring --- src/auth_middleware.rs | 5 +---- src/problem.rs | 4 ---- src/status.rs | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/auth_middleware.rs b/src/auth_middleware.rs index 8c8ba3e..13645c0 100644 --- a/src/auth_middleware.rs +++ b/src/auth_middleware.rs @@ -32,10 +32,7 @@ impl AuthContext { } pub fn admin_scope(auth_context: &AuthContext) -> bool { - match auth_context.subject { - Subject::Admin(_) => true, - _ => false, - } + matches!(auth_context.subject, Subject::Admin(_)) } impl FromRequest for AuthContext { diff --git a/src/problem.rs b/src/problem.rs index 984b51e..c22c84f 100644 --- a/src/problem.rs +++ b/src/problem.rs @@ -1,9 +1,5 @@ -use actix; -use actix_web; use log::error; use serde_derive::{Deserialize, Serialize}; -use serde_json; -use std; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Problem { diff --git a/src/status.rs b/src/status.rs index a38a133..d15f68f 100644 --- a/src/status.rs +++ b/src/status.rs @@ -20,7 +20,7 @@ impl Status { } } -pub fn status_resource(version: Option) -> impl FnOnce(&mut Resource) -> () { +pub fn status_resource(version: Option) -> impl FnOnce(&mut Resource) { let status = Status::new(version); |r: &mut Resource| r.method(Method::GET).f(move |_| status.status())