tape inventory: code cleanup media pool look-up

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-01-16 11:04:07 +01:00
parent 6905bd3735
commit 7792507a12

View File

@ -249,14 +249,11 @@ impl Inventory {
///
/// Returns (pool, is_empty)
pub fn lookup_media_pool(&self, uuid: &Uuid) -> Option<(&str, bool)> {
match self.map.get(uuid) {
None => None,
Some(entry) => entry
.id
.media_set_label
.as_ref()
.map(|set| (set.pool.as_str(), set.unassigned())),
}
let pool = self.map.get(uuid)?;
pool.id
.media_set_label
.as_ref()
.map(|media_set| (media_set.pool.as_str(), media_set.unassigned()))
}
/// List all media assigned to the pool