clippy: fix for_kv_map
and allow it in the one case where the entry loop is intended, but the code is not yet implemented fully. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
382f10a0cc
commit
f2f81791d1
|
@ -372,6 +372,7 @@ impl AclTreeNode {
|
||||||
fn extract_group_roles(&self, _user: &Userid, leaf: bool) -> HashMap<String, bool> {
|
fn extract_group_roles(&self, _user: &Userid, leaf: bool) -> HashMap<String, bool> {
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
|
|
||||||
|
#[allow(clippy::for_kv_map)]
|
||||||
for (_group, roles) in &self.groups {
|
for (_group, roles) in &self.groups {
|
||||||
let is_member = false; // fixme: check if user is member of the group
|
let is_member = false; // fixme: check if user is member of the group
|
||||||
if !is_member {
|
if !is_member {
|
||||||
|
|
|
@ -39,7 +39,7 @@ fn function_calls() -> Vec<(&'static str, fn() -> String)> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut list = Vec::new();
|
let mut list = Vec::new();
|
||||||
for (store, _) in &config.sections {
|
for store in config.sections.keys() {
|
||||||
list.push(store.as_str());
|
list.push(store.as_str());
|
||||||
}
|
}
|
||||||
list.join(", ")
|
list.join(", ")
|
||||||
|
|
|
@ -215,13 +215,14 @@ impl Inventory {
|
||||||
|
|
||||||
/// find media by label_text
|
/// find media by label_text
|
||||||
pub fn find_media_by_label_text(&self, label_text: &str) -> Option<&MediaId> {
|
pub fn find_media_by_label_text(&self, label_text: &str) -> Option<&MediaId> {
|
||||||
for (_uuid, entry) in &self.map {
|
self.map.values().find_map(|entry| {
|
||||||
if entry.id.label.label_text == label_text {
|
if entry.id.label.label_text == label_text {
|
||||||
return Some(&entry.id);
|
Some(&entry.id)
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Lookup media pool
|
/// Lookup media pool
|
||||||
///
|
///
|
||||||
|
@ -245,7 +246,7 @@ impl Inventory {
|
||||||
pub fn list_pool_media(&self, pool: &str) -> Vec<MediaId> {
|
pub fn list_pool_media(&self, pool: &str) -> Vec<MediaId> {
|
||||||
let mut list = Vec::new();
|
let mut list = Vec::new();
|
||||||
|
|
||||||
for (_uuid, entry) in &self.map {
|
for entry in self.map.values() {
|
||||||
match entry.id.media_set_label {
|
match entry.id.media_set_label {
|
||||||
None => continue, // not assigned to any pool
|
None => continue, // not assigned to any pool
|
||||||
Some(ref set) => {
|
Some(ref set) => {
|
||||||
|
@ -272,7 +273,7 @@ impl Inventory {
|
||||||
pub fn list_used_media(&self) -> Vec<MediaId> {
|
pub fn list_used_media(&self) -> Vec<MediaId> {
|
||||||
let mut list = Vec::new();
|
let mut list = Vec::new();
|
||||||
|
|
||||||
for (_uuid, entry) in &self.map {
|
for entry in self.map.values() {
|
||||||
match entry.id.media_set_label {
|
match entry.id.media_set_label {
|
||||||
None => continue, // not assigned to any pool
|
None => continue, // not assigned to any pool
|
||||||
Some(ref set) => {
|
Some(ref set) => {
|
||||||
|
@ -288,15 +289,13 @@ impl Inventory {
|
||||||
|
|
||||||
/// List media not assigned to any pool
|
/// List media not assigned to any pool
|
||||||
pub fn list_unassigned_media(&self) -> Vec<MediaId> {
|
pub fn list_unassigned_media(&self) -> Vec<MediaId> {
|
||||||
let mut list = Vec::new();
|
self.map.values().filter_map(|entry|
|
||||||
|
|
||||||
for (_uuid, entry) in &self.map {
|
|
||||||
if entry.id.media_set_label.is_none() {
|
if entry.id.media_set_label.is_none() {
|
||||||
list.push(entry.id.clone());
|
Some(entry.id.clone())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
}
|
).collect()
|
||||||
|
|
||||||
list
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn media_set_start_time(&self, media_set_uuid: &Uuid) -> Option<i64> {
|
pub fn media_set_start_time(&self, media_set_uuid: &Uuid) -> Option<i64> {
|
||||||
|
|
Loading…
Reference in New Issue