From 3cd8c5700b90f3cf9afbbee078df1bb9346f86a0 Mon Sep 17 00:00:00 2001 From: jthulhu <23179762+jthulhu@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:34:23 +0200 Subject: [PATCH] Corrected minor non-idiomatic snippet of code (#3108) * Corrected minor non-idiomaticity. * Added to CONTRIBUTORS. --- CONTRIBUTORS | 1 + rslib/process/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ccbca7e4f..c7d00dc62 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -169,6 +169,7 @@ Vasll laalsaas ijqq AntoineQ1 +jthulhu ******************** The text of the 3 clause BSD license follows: diff --git a/rslib/process/src/lib.rs b/rslib/process/src/lib.rs index fcf91ae2c..d026dec34 100644 --- a/rslib/process/src/lib.rs +++ b/rslib/process/src/lib.rs @@ -2,6 +2,7 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use std::ffi::OsStr; +use std::iter::once; use std::process::Command; use std::string::FromUtf8Error; @@ -96,8 +97,7 @@ impl CommandExt for Command { } fn get_cmdline(arg: &mut Command) -> String { - [arg.get_program().to_string_lossy()] - .into_iter() + once(arg.get_program().to_string_lossy()) .chain(arg.get_args().map(|arg| arg.to_string_lossy())) .join(" ") }