From 866386e21f1b0c9f584ba9e4803eccab2e47eb98 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Mon, 12 Jun 2023 13:19:42 +0800 Subject: [PATCH] Use to_string instead of to_owned --- native/src/boot/cpio.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/src/boot/cpio.rs b/native/src/boot/cpio.rs index 18f0cea90..d93412b8f 100644 --- a/native/src/boot/cpio.rs +++ b/native/src/boot/cpio.rs @@ -379,10 +379,10 @@ impl Cpio { fn ls(&self, path: Option<&str>, recursive: bool) { let path = path .map(norm_path) - .map(|p| "/".to_owned() + p.as_str()) - .unwrap_or("".to_string()); + .filter(|p| !p.is_empty()) + .map_or("".to_string(), |p| "/".to_string() + p.as_str()); for (name, entry) in &self.entries { - let p = "/".to_owned() + name.as_str(); + let p = "/".to_string() + name.as_str(); if !p.starts_with(&path) { continue; }