Skip to content

Commit 46f2221

Browse files
map strs as well
1 parent 86bc65c commit 46f2221

File tree

1 file changed

+3
-7
lines changed
  • frameworks/keyed/leptos/src

1 file changed

+3
-7
lines changed

frameworks/keyed/leptos/src/lib.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,12 @@ static ID_COUNTER: AtomicUsize = AtomicUsize::new(1);
5050
fn build_data(count: usize) -> Vec<RowData> {
5151
let mut thread_rng = thread_rng();
5252

53-
let mut choose =
54-
|slice: &[&'static str]| slice.choose(&mut thread_rng).unwrap();
55-
5653
(0..count)
5754
.map(|_| RowData {
5855
id: ID_COUNTER.fetch_add(1, Ordering::Relaxed),
59-
label: ArcRwSignal::new(format!("{} {} {}",
60-
choose(ADJECTIVES),
61-
choose(COLOURS),
62-
choose(NOUNS))),
56+
label: ArcRwSignal::new([ADJECTIVES, COLOURS, NOUNS]
57+
.map(|slice| slice.choose(&mut thread_rng).unwrap())
58+
.join(" "))
6359
})
6460
.collect()
6561
}

0 commit comments

Comments
 (0)