diff --git a/core/src/system/diskpart.rs b/core/src/system/diskpart.rs index fa3649d..f25e60e 100644 --- a/core/src/system/diskpart.rs +++ b/core/src/system/diskpart.rs @@ -149,13 +149,12 @@ pub fn build_dest_format_script(disk_id: usize, part_type: &PartitionTableType) #[must_use] pub fn build_get_disk_script(disk_nums: Option>) -> String { - let capacity = DEFAULT_MAX_DISKS * 3 + 1; let script: String; // Get disk and partition details if let Some(disks) = disk_nums { // (Slower case) - let mut script_parts = Vec::with_capacity(capacity); + let mut script_parts = Vec::with_capacity(DEFAULT_MAX_DISKS * 3 + 1); // Get list of disks script_parts.push(String::from("list disk")); @@ -171,7 +170,7 @@ pub fn build_get_disk_script(disk_nums: Option>) -> String { script = script_parts.join("\n"); } else { // (Best case) - let mut script_parts = Vec::with_capacity(capacity); + let mut script_parts = Vec::with_capacity(DEFAULT_MAX_DISKS + 1); // Get list of disks script_parts.push("list disk"); @@ -181,9 +180,9 @@ pub fn build_get_disk_script(disk_nums: Option>) -> String { script_parts.push("detail disk"); script_parts.push("list partition"); - // Limit to 8 disks (if there's more the manual "worst" case will be used) + // Limit to DEFAULT_MAX_DISKS (if there's more the manual "worst" case will be used) let mut i = 0; - while i < 8 { + while i < DEFAULT_MAX_DISKS { script_parts.push("select disk next"); script_parts.push("detail disk"); script_parts.push("list partition");