summaryrefslogtreecommitdiff
path: root/cli/tools/vendor/test.rs
diff options
context:
space:
mode:
authorYiyu Lin <linyiyu1992@gmail.com>2023-01-06 03:29:50 +0800
committerGitHub <noreply@github.com>2023-01-05 14:29:50 -0500
commit896dd56b7af06fea6604a5596a6ffd17e7e52e6e (patch)
tree92d3c94afe4923f1d1faccc8034a03f78b807ade /cli/tools/vendor/test.rs
parent4e6b78cb43ece70df28281c8033b51366b110acf (diff)
refactor(cli,core,ext,rt): remove some unnecessary `clone` or `malloc` (#17274)
Diffstat (limited to 'cli/tools/vendor/test.rs')
-rw-r--r--cli/tools/vendor/test.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/tools/vendor/test.rs b/cli/tools/vendor/test.rs
index 61c885731..7171b8463 100644
--- a/cli/tools/vendor/test.rs
+++ b/cli/tools/vendor/test.rs
@@ -242,7 +242,7 @@ impl VendorTestBuilder {
let import_map = files.remove(&output_dir.join("import_map.json"));
let mut files = files
.iter()
- .map(|(path, text)| (path_to_string(path), text.clone()))
+ .map(|(path, text)| (path_to_string(path), text.to_string()))
.collect::<Vec<_>>();
files.sort_by(|a, b| a.0.cmp(&b.0));
@@ -293,7 +293,11 @@ fn make_path(text: &str) -> PathBuf {
}
}
-fn path_to_string(path: &Path) -> String {
+fn path_to_string<P>(path: P) -> String
+where
+ P: AsRef<Path>,
+{
+ let path = path.as_ref();
// inverse of the function above
let path = path.to_string_lossy();
if cfg!(windows) {