From b4a798f0a74ac532f736a18040b648dd2d08ff5c Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 24 Oct 2022 13:44:22 +0200 Subject: [PATCH] section-config: use Vec for section order We use none of the additional functionality provided by VecDeque. Signed-off-by: Wolfgang Bumiller --- proxmox-section-config/src/lib.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/proxmox-section-config/src/lib.rs b/proxmox-section-config/src/lib.rs index 080f23cf..420e2512 100644 --- a/proxmox-section-config/src/lib.rs +++ b/proxmox-section-config/src/lib.rs @@ -20,7 +20,6 @@ use std::collections::HashMap; use std::collections::HashSet; -use std::collections::VecDeque; use anyhow::{bail, format_err, Error}; use serde::de::DeserializeOwned; @@ -102,7 +101,7 @@ enum ParseState<'a> { #[derive(Debug)] pub struct SectionConfigData { pub sections: HashMap, - order: VecDeque, + order: Vec, } impl Default for SectionConfigData { @@ -116,7 +115,7 @@ impl SectionConfigData { pub fn new() -> Self { Self { sections: HashMap::new(), - order: VecDeque::new(), + order: Vec::new(), } } @@ -167,7 +166,7 @@ impl SectionConfigData { /// /// Sections are written in the recorder order. pub fn record_order(&mut self, section_id: &str) { - self.order.push_back(section_id.to_string()); + self.order.push(section_id.to_string()); } /// API helper to represent configuration data as array. @@ -302,7 +301,7 @@ impl SectionConfig { } fn write_do(&self, config: &SectionConfigData) -> Result { - let mut list = VecDeque::new(); + let mut list = Vec::new(); let mut done = HashSet::new(); @@ -310,7 +309,7 @@ impl SectionConfig { if config.sections.get(section_id) == None { continue; }; - list.push_back(section_id); + list.push(section_id); done.insert(section_id); } @@ -318,7 +317,7 @@ impl SectionConfig { if done.contains(section_id) { continue; }; - list.push_back(section_id); + list.push(section_id); } let mut raw = String::new();