1
0
Эх сурвалжийг харах

Turning off unused_variables revealed a warning

Benjamin Sago 8 жил өмнө
parent
commit
3331feaee8

+ 0 - 13
src/options/mod.rs

@@ -109,12 +109,6 @@ pub struct Options {
 
 impl Options {
 
-    // Even though the arguments go in as OsStrings, they come out
-    // as Strings. Invalid UTF-8 won’t be parsed, but it won’t make
-    // exa core dump either.
-    //
-    // https://github.com/rust-lang-nursery/getopts/pull/29
-
     /// Call getopts on the given slice of command-line strings.
     #[allow(unused_results)]
     pub fn getopts<'args, I>(args: I) -> Result<(Options, Vec<&'args OsStr>), Misfire>
@@ -188,13 +182,6 @@ mod test {
         assert!(outs.is_empty());  // Listing the `.` directory is done in main.rs
     }
 
-    #[test]
-    fn file_sizes() {
-        let args = [ os("--long"), os("--binary"), os("--bytes") ];
-        let opts = Options::getopts(&args);
-        assert_eq!(opts.unwrap_err(), Misfire::Conflict(&flags::BINARY, &flags::BYTES))
-    }
-
     #[test]
     fn just_binary() {
         let args = [ os("--binary") ];

+ 1 - 3
src/options/parser.rs

@@ -28,8 +28,6 @@
 //! `--sort size`) are guaranteed to just be 8-bit ASCII.
 
 
-#![allow(unused_variables, dead_code)]
-
 use std::ffi::{OsStr, OsString};
 use std::fmt;
 
@@ -209,7 +207,7 @@ where I: IntoIterator<Item=&'args OsString> {
                     }
                 }
 
-                let arg = args.lookup_short(*before.as_bytes().last().unwrap())?;
+                let arg = args.lookup_short(*arg_with_value)?;
                 let flag = Flag::Short(arg.short.unwrap());
                 match arg.takes_value {
                     Necessary  => results.flags.push((flag, Some(after))),