Denis Cornehl 3 anni fa
parent
commit
0bf3148db0
2 ha cambiato i file con 3 aggiunte e 4 eliminazioni
  1. 1 1
      src/options/error.rs
  2. 2 3
      src/options/view.rs

+ 1 - 1
src/options/error.rs

@@ -14,7 +14,7 @@ pub enum OptionsError {
     Parse(ParseError),
 
     /// The user supplied an illegal choice to an Argument.
-    BadArgument(&'static Arg, String),
+    BadArgument(&'static Arg, OsString),
 
     /// The user supplied a set of options that are unsupported
     Unsupported(String),

+ 2 - 3
src/options/view.rs

@@ -254,14 +254,13 @@ impl TimeFormat {
                 }
             };
 
-        let word = word.to_string_lossy();
-        match word.as_ref() {
+        match word.to_string_lossy().as_ref() {
             "default"  => Ok(Self::DefaultFormat),
             "relative" => Ok(Self::Relative),
             "iso"      => Ok(Self::ISOFormat),
             "long-iso" => Ok(Self::LongISO),
             "full-iso" => Ok(Self::FullISO),
-            _ => Err(OptionsError::BadArgument(&flags::TIME_STYLE, word.to_string()))
+            _ => Err(OptionsError::BadArgument(&flags::TIME_STYLE, word))
         }
     }
 }