From 23f02f241e4531d9dcc12eebd8b1e77f757aa33e Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Tue, 5 Jul 2022 21:08:19 -0400 Subject: [PATCH] Run the code formatter --- meilisearch-auth/src/store.rs | 45 ++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/meilisearch-auth/src/store.rs b/meilisearch-auth/src/store.rs index 8697afc38..9b9cf41e0 100644 --- a/meilisearch-auth/src/store.rs +++ b/meilisearch-auth/src/store.rs @@ -1,5 +1,6 @@ use std::borrow::Cow; use std::cmp::Reverse; +use std::collections::HashSet; use std::convert::TryFrom; use std::convert::TryInto; use std::fs::create_dir_all; @@ -7,7 +8,6 @@ use std::ops::Deref; use std::path::Path; use std::str; use std::sync::Arc; -use std::collections::HashSet; use enum_iterator::IntoEnumIterator; use hmac::{Hmac, Mac}; @@ -92,13 +92,42 @@ impl HeedAuthStore { for action in &key.actions { match action { Action::All => actions.extend(Action::into_enum_iter()), - Action::DocumentsAll => { actions.extend([Action::DocumentsGet, Action::DocumentsDelete, Action::DocumentsGet].iter()); }, - Action::IndexesAll => { actions.extend([Action::IndexesAdd, Action::IndexesDelete, Action::IndexesUpdate, Action::IndexesUpdate].iter()); }, - Action::SettingsAll => { actions.extend([Action::SettingsGet, Action::SettingsUpdate].iter()); }, - Action::DumpsAll => { actions.insert(Action::DumpsCreate); }, - Action::TasksAll => { actions.insert(Action::TasksGet); }, - Action::StatsAll => { actions.insert(Action::StatsGet); }, - other => { actions.insert(*other); } + Action::DocumentsAll => { + actions.extend( + [ + Action::DocumentsGet, + Action::DocumentsDelete, + Action::DocumentsGet, + ] + .iter(), + ); + } + Action::IndexesAll => { + actions.extend( + [ + Action::IndexesAdd, + Action::IndexesDelete, + Action::IndexesUpdate, + Action::IndexesUpdate, + ] + .iter(), + ); + } + Action::SettingsAll => { + actions.extend([Action::SettingsGet, Action::SettingsUpdate].iter()); + } + Action::DumpsAll => { + actions.insert(Action::DumpsCreate); + } + Action::TasksAll => { + actions.insert(Action::TasksGet); + } + Action::StatsAll => { + actions.insert(Action::StatsGet); + } + other => { + actions.insert(*other); + } } }