[pve-devel] [PATCH perl-rs 5/5] apt: minor parameter cleanup

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Jul 9 08:20:26 CEST 2024


We cannot use &[&str] - since this would be a poitner to a `[&str]`
data structure, that's not how perl stores strings.
But we *can* use Vec<&str> - here, the Vec will be allocated, but the
contents will borrow. We don't need to transform this afterwards.

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 common/src/apt/repositories.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/src/apt/repositories.rs b/common/src/apt/repositories.rs
index 8ad29cc..aff3522 100644
--- a/common/src/apt/repositories.rs
+++ b/common/src/apt/repositories.rs
@@ -77,9 +77,8 @@ pub mod export {
         product_virtual_package: &str,
         api_server_package: &str,
         running_api_server_version: &str,
-        package_list: Vec<String>,
+        package_list: Vec<&str>,
     ) -> Result<Vec<APTUpdateInfo>, Error> {
-        let package_list: Vec<&str> = package_list.iter().map(|s| s.as_ref()).collect();
         proxmox_apt::get_package_versions(
             product_virtual_package,
             api_server_package,
-- 
2.39.2





More information about the pve-devel mailing list