Turning off unused_variables revealed a warning

This commit is contained in:
Benjamin Sago 2017-08-05 15:40:15 +01:00
parent b46fd1e32f
commit 3331feaee8
2 changed files with 1 additions and 16 deletions

View File

@ -109,12 +109,6 @@ pub struct Options {
impl Options { impl Options {
// Even though the arguments go in as OsStrings, they come out
// as Strings. Invalid UTF-8 wont be parsed, but it wont make
// exa core dump either.
//
// https://github.com/rust-lang-nursery/getopts/pull/29
/// Call getopts on the given slice of command-line strings. /// Call getopts on the given slice of command-line strings.
#[allow(unused_results)] #[allow(unused_results)]
pub fn getopts<'args, I>(args: I) -> Result<(Options, Vec<&'args OsStr>), Misfire> 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 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] #[test]
fn just_binary() { fn just_binary() {
let args = [ os("--binary") ]; let args = [ os("--binary") ];

View File

@ -28,8 +28,6 @@
//! `--sort size`) are guaranteed to just be 8-bit ASCII. //! `--sort size`) are guaranteed to just be 8-bit ASCII.
#![allow(unused_variables, dead_code)]
use std::ffi::{OsStr, OsString}; use std::ffi::{OsStr, OsString};
use std::fmt; 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()); let flag = Flag::Short(arg.short.unwrap());
match arg.takes_value { match arg.takes_value {
Necessary => results.flags.push((flag, Some(after))), Necessary => results.flags.push((flag, Some(after))),