Fix needless_collect lint
Part of rust release 1.54 included a lint checking for needless
collections on iterators. This fixes the one place clippy found it in
libsplinter.
@@ -1011,8 +1011,8 @@ impl AdminServiceStore for YamlAdminServiceStore {
fn list_nodes(
&self,
) -> Result<Box<dyn ExactSizeIterator<Item = CircuitNode>>, AdminServiceStoreError> {
- let nodes: Vec<CircuitNode> = self
- .state
+ let nodes: Box<dyn ExactSizeIterator<Item = CircuitNode>> = Box::new(
+ self.state
.lock()
.map_err(|_| {
AdminServiceStoreError::InternalError(InternalError::with_message(
@@ -1023,9 +1023,11 @@ impl AdminServiceStore for YamlAdminServiceStore {
.nodes
.iter()
.map(|(_, node)| node.clone())
- .collect();
+ .collect::<Vec<_>>()
+ .into_iter(),
+ );
- Ok(Box::new(nodes.into_iter()))
+ Ok(nodes)
}
/// Fetches a service from the underlying storage
