From d906701b0eff32759cdf386221be3fac9a6e4379 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Tue, 24 Mar 2015 16:21:10 -0400 Subject: [PATCH] testing to_owned() --- src/app.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app.rs b/src/app.rs index 1e7df888..25f45262 100644 --- a/src/app.rs +++ b/src/app.rs @@ -6,6 +6,7 @@ use std::collections::HashSet; use std::env; use std::path::Path; use std::vec::IntoIter; +use std::borrow::ToOwned; use args::{ ArgMatches, Arg, SubCommand }; use args::{FlagArg, FlagBuilder}; @@ -76,7 +77,7 @@ impl<'a, 'v, 'ab, 'u> App<'a, 'v, 'ab, 'u>{ /// ``` pub fn new<'n>(n: &'n str) -> App<'a, 'v, 'ab, 'u> { App { - name: n.to_string(), + name: n.to_owned(), author: None, about: None, version: None, @@ -571,7 +572,7 @@ impl<'a, 'v, 'ab, 'u> App<'a, 'v, 'ab, 'u>{ _ => {} } if ! self.required.is_empty() { - self.report_error("One or more required arguments were not supplied".to_string(), + self.report_error("One or more required arguments were not supplied".to_owned(), true, true); } @@ -612,7 +613,7 @@ impl<'a, 'v, 'ab, 'u> App<'a, 'v, 'ab, 'u>{ }); } if self.needs_subcmd_help && !self.subcommands.is_empty() { - self.subcommands.insert("help".to_string(), Box::new(App::new("help").about("Prints this message"))); + self.subcommands.insert("help".to_owned(), Box::new(App::new("help").about("Prints this message"))); } } @@ -642,7 +643,7 @@ impl<'a, 'v, 'ab, 'u> App<'a, 'v, 'ab, 'u>{ if arg_vec[1].len() == 0 { self.report_error(format!("Argument --{} requires a value, but none was supplied", arg), true, true); } - arg_val = Some(arg_vec[1].to_string()); + arg_val = Some(arg_vec[1].to_owned()); } if let Some(v) = self.opts.values().filter(|&v| v.long.is_some()).filter(|&v| v.long.unwrap() == arg).nth(0) {