From 3331feaee8cd49df6e13c6289cabb9fa3c36c7af Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Sat, 5 Aug 2017 15:40:15 +0100 Subject: [PATCH] Turning off unused_variables revealed a warning --- src/options/mod.rs | 13 ------------- src/options/parser.rs | 4 +--- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/options/mod.rs b/src/options/mod.rs index 62a1bca..2927f57 100644 --- a/src/options/mod.rs +++ b/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") ]; diff --git a/src/options/parser.rs b/src/options/parser.rs index 80f88e9..16972c0 100644 --- a/src/options/parser.rs +++ b/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 { } } - 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))),