CrateData: don't allocate String when Serialize, &str is enough

This commit is contained in:
klensy
2023-01-13 18:27:30 +03:00
parent ffb2e84319
commit 8998bd35ed
+1 -1
View File
@@ -299,7 +299,7 @@ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
)?;
crate_data.serialize_field(
"p",
&self.paths.iter().map(|(it, s)| (it, s.to_string())).collect::<Vec<_>>(),
&self.paths.iter().map(|(it, s)| (it, s.as_str())).collect::<Vec<_>>(),
)?;
if has_aliases {
crate_data.serialize_field("a", &self.aliases)?;