diff --git a/Cargo.toml b/Cargo.toml index 84c2eaa..04b5649 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "microtools" version = "0.1.0" -authors = ["Bodo Junglas "] +authors = ["Bodo Junglas ", "Ihor Mordashev bool { - match auth_context.subject { - Subject::Admin(_) => true, - _ => false, - } + matches!(auth_context.subject, Subject::Admin(_)) } impl FromRequest for AuthContext { diff --git a/src/gatekeeper.rs b/src/gatekeeper.rs index 3e7b397..0b26a0c 100644 --- a/src/gatekeeper.rs +++ b/src/gatekeeper.rs @@ -43,8 +43,8 @@ impl TokenCreator { let mut scopes_map: Map = Map::new(); for (key, values_raw) in scopes { - let values = values_raw.iter().map(|v| Value::String(v.to_string())).collect(); - scopes_map.insert(key.to_string(), Value::Array(values)); + let values = values_raw.iter().map(|&v| Value::String(v.to_string())).collect(); + scopes_map.insert((*key).to_string(), Value::Array(values)); } claims.insert("scopes".to_string(), Value::Object(scopes_map)); 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())