Skip to content

Commit a80ce34

Browse files
committed
optimize the vec initialization
Signed-off-by: kerthcet <kerthcet@gmail.com>
1 parent 6691478 commit a80ce34

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

server/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl Server {
227227
#[pyo3(signature = (labels=None))]
228228
fn list_daemons(&self, labels: Option<HashMap<String, String>>) -> PyResult<Vec<PyDaemonInfo>> {
229229
let daemon_ids = self.registry.list_all(labels.as_ref());
230-
let mut result = Vec::new();
230+
let mut result = Vec::with_capacity(daemon_ids.len());
231231

232232
for daemon_id in daemon_ids {
233233
if let Some(conn) = self.registry.get(&daemon_id) {

0 commit comments

Comments
 (0)