From 62c17ab41152a24430b77044a41dea2a21b2a8cd Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Mon, 14 Jun 2021 10:57:44 -0400 Subject: [PATCH] Fix arg parsing on Windows --- cli/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cli/src/lib.rs b/cli/src/lib.rs index b247bfee6..8b61c12f8 100644 --- a/cli/src/lib.rs +++ b/cli/src/lib.rs @@ -31,8 +31,7 @@ For the public TaskChampion Rust API, see the `taskchampion` crate. */ -use std::os::unix::ffi::OsStringExt; -use std::string::FromUtf8Error; +use std::ffi::OsString; // NOTE: it's important that this 'mod' comes first so that the macros can be used in other modules mod macros; @@ -63,8 +62,8 @@ pub fn main() -> Result<(), Error> { // parse the command line into a vector of &str, failing if // there are invalid utf-8 sequences. let argv: Vec = std::env::args_os() - .map(|oss| String::from_utf8(oss.into_vec())) - .collect::>() + .map(|oss| oss.into_string()) + .collect::>() .map_err(|_| Error::for_arguments("arguments must be valid utf-8"))?; let argv: Vec<&str> = argv.iter().map(|s| s.as_ref()).collect();