Skip to content

Commit 8d596e3

Browse files
committed
Simplify serialize_as_array
1 parent de24558 commit 8d596e3

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sync-team/src/zulip/api.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,7 @@ impl ZulipApi {
287287

288288
/// Serialize a slice of numbers as a JSON array
289289
fn serialize_as_array(items: &[u64]) -> String {
290-
let items = items
291-
.iter()
292-
.map(|id| id.to_string())
293-
.collect::<Vec<_>>()
294-
.join(",");
295-
format!("[{items}]")
290+
serde_json::to_string(&items).expect("cannot serialize JSON array")
296291
}
297292

298293
/// A collection of Zulip users

0 commit comments

Comments
 (0)