From ae1074c601a9e273bec461bbc20b2d84b3b2efe3 Mon Sep 17 00:00:00 2001 From: Yash Karandikar Date: Sun, 7 Nov 2021 11:32:25 -0600 Subject: [PATCH] Use map instead of pushing to a new vec --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 973c260..5599b7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "circe" -version = "0.1.1" +version = "0.1.2" dependencies = [ "serde", "serde_derive", diff --git a/Cargo.toml b/Cargo.toml index 0b14f86..46d58eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "circe" -version = "0.1.1" +version = "0.1.2" edition = "2021" license = "Unlicense" description = "IRC crate in Rust" diff --git a/src/lib.rs b/src/lib.rs index f7f9574..269b265 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -403,10 +403,7 @@ impl Config { username: &str, ) -> Self { // Conversion from &'static str to String - let mut channels_config = Vec::new(); - channels - .iter() - .for_each(|channel| channels_config.push(channel.to_string())); + let channels_config = channels.iter().map(|channel| channel.to_string()).collect(); let mode_config: Option; if mode.is_some() {