Skip to content

Commit

Permalink
Implement requested changes for default_return and HashMap::collect()
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Aug 26, 2019
1 parent efdd131 commit 189e0bf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
8 changes: 3 additions & 5 deletions src/dbus_api/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@ fn rename_filesystem(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
let (rc, rs) = (DbusErrorEnum::INTERNAL_ERROR as u16, error_message);
return_message.append3(default_return, rc, rs)
}
Ok(RenameAction::Identity) => return_message.append3(
(false, uuid_to_string!(FilesystemUuid::nil())),
msg_code_ok(),
msg_string_ok(),
),
Ok(RenameAction::Identity) => {
return_message.append3(default_return, msg_code_ok(), msg_string_ok())
}
Ok(RenameAction::Renamed(uuid)) => return_message.append3(
(true, uuid_to_string!(uuid)),
msg_code_ok(),
Expand Down
15 changes: 8 additions & 7 deletions src/dbus_api/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,14 @@ fn destroy_filesystems(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
let mut engine = dbus_context.engine.borrow_mut();
let (pool_name, pool) = get_mut_pool!(engine; pool_uuid; default_return; return_message);

let mut filesystem_map: HashMap<Uuid, dbus::Path<'static>> = HashMap::new();
for op in filesystem_paths.filter_map(|path| m.tree.get(&path)) {
let uuid_option = op.get_data().as_ref().map(|d| d.uuid);
if let Some(ref uuid) = uuid_option {
filesystem_map.insert(*uuid, op.get_name().clone());
}
}
let filesystem_map: HashMap<Uuid, dbus::Path<'static>> = filesystem_paths
.filter_map(|path| m.tree.get(&path))
.filter_map(|op| {
op.get_data()
.as_ref()
.map(|d| (d.uuid, op.get_name().clone()))
})
.collect();

let result = pool.destroy_filesystems(
&pool_name,
Expand Down
1 change: 0 additions & 1 deletion src/engine/sim_engine/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,4 @@ mod tests {
Ok(RenameAction::NoSource)
);
}

}
1 change: 0 additions & 1 deletion src/engine/strat_engine/backstore/metadata/bda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,5 +852,4 @@ mod tests {
MetadataLocation::First,
);
}

}

0 comments on commit 189e0bf

Please sign in to comment.