From 8536760e7802a498f7c6d9fe8fb4c7920a1c6e71 Mon Sep 17 00:00:00 2001 From: EdJoPaTo Date: Tue, 27 Feb 2024 13:34:22 +0100 Subject: [PATCH] refactor: clippy::inefficient_to_string (#974) --- Cargo.toml | 1 + src/widgets/list.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 81a1e64a..a044bc86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,7 @@ unsafe_code = "forbid" cloned_instead_of_copied = "warn" explicit_iter_loop = "warn" implicit_clone = "warn" +inefficient_to_string = "warn" missing_const_for_fn = "warn" needless_for_each = "warn" semicolon_if_nothing_returned = "warn" diff --git a/src/widgets/list.rs b/src/widgets/list.rs index 8456eccf..cb765407 100755 --- a/src/widgets/list.rs +++ b/src/widgets/list.rs @@ -1197,7 +1197,7 @@ mod tests { /// helper method to take a vector of strings and return a vector of list items fn list_items(items: Vec<&str>) -> Vec { - items.iter().map(|i| ListItem::new(i.to_string())).collect() + items.into_iter().map(ListItem::new).collect() } /// helper method to render a widget to an empty buffer with the default state