libgetopts: Remove all uses of ~str from libgetopts

This commit is contained in:
Patrick Walton
2014-05-14 21:39:11 -07:00
parent 28bcef85e4
commit 1fb08f11b7
8 changed files with 275 additions and 248 deletions

View File

@@ -354,11 +354,7 @@ Test Attributes:
pub fn parse_opts(args: &[StrBuf]) -> Option<OptRes> {
let args_ = args.tail();
let matches =
match getopts::getopts(args_.iter()
.map(|x| x.to_owned())
.collect::<Vec<_>>()
.as_slice(),
optgroups().as_slice()) {
match getopts::getopts(args_.as_slice(), optgroups().as_slice()) {
Ok(m) => m,
Err(f) => return Some(Err(f.to_err_msg().to_strbuf()))
};
@@ -388,7 +384,8 @@ pub fn parse_opts(args: &[StrBuf]) -> Option<OptRes> {
let ratchet_metrics = ratchet_metrics.map(|s| Path::new(s));
let ratchet_noise_percent = matches.opt_str("ratchet-noise-percent");
let ratchet_noise_percent = ratchet_noise_percent.map(|s| from_str::<f64>(s).unwrap());
let ratchet_noise_percent =
ratchet_noise_percent.map(|s| from_str::<f64>(s.as_slice()).unwrap());
let save_metrics = matches.opt_str("save-metrics");
let save_metrics = save_metrics.map(|s| Path::new(s));