summary refs log tree commit diff
path: root/src/libgetopts
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-19 18:36:59 +0000
committerbors <bors@rust-lang.org>2015-02-19 18:36:59 +0000
commit522d09dfecbeca1595f25ac58c6d0178bbd21d7d (patch)
treecc0252dd3413e5f890d0ebcfdaa096e5b002be0b /src/libgetopts
parent0b664bb8436f2cfda7f13a6f302ab486f332816f (diff)
parent49771bafa5fca16486bfd06741dac3de2c587adf (diff)
downloadrust-1.0.0-alpha.2.tar.gz
rust-1.0.0-alpha.2.zip
Auto merge of #22541 - Manishearth:rollup, r=Gankro 1.0.0-alpha.2
Continued from #22520
Diffstat (limited to 'src/libgetopts')
-rw-r--r--src/libgetopts/lib.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs
index c743119f409..fdd7f7395c2 100644
--- a/src/libgetopts/lib.rs
+++ b/src/libgetopts/lib.rs
@@ -287,7 +287,7 @@ impl OptGroup {
 
 impl Matches {
     fn opt_vals(&self, nm: &str) -> Vec<Optval> {
-        match find_opt(&self.opts[], Name::from_str(nm)) {
+        match find_opt(&self.opts[..], Name::from_str(nm)) {
             Some(id) => self.vals[id].clone(),
             None => panic!("No option '{}' defined", nm)
         }
@@ -326,7 +326,7 @@ impl Matches {
     /// Returns the string argument supplied to one of several matching options or `None`.
     pub fn opts_str(&self, names: &[String]) -> Option<String> {
         for nm in names {
-            match self.opt_val(&nm[]) {
+            match self.opt_val(&nm[..]) {
                 Some(Val(ref s)) => return Some(s.clone()),
                 _ => ()
             }
@@ -593,7 +593,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
     while i < l {
         let cur = args[i].clone();
         let curlen = cur.len();
-        if !is_arg(&cur[]) {
+        if !is_arg(&cur[..]) {
             free.push(cur);
         } else if cur == "--" {
             let mut j = i + 1;
@@ -667,7 +667,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
                         v.push(Val((i_arg.clone())
                             .unwrap()));
                     } else if name_pos < names.len() || i + 1 == l ||
-                            is_arg(&args[i + 1][]) {
+                            is_arg(&args[i + 1][..]) {
                         let v = &mut vals[optid];
                         v.push(Given);
                     } else {
@@ -730,7 +730,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
             0 => {}
             1 => {
                 row.push('-');
-                row.push_str(&short_name[]);
+                row.push_str(&short_name[..]);
                 row.push(' ');
             }
             _ => panic!("the short name should only be 1 ascii char long"),
@@ -741,7 +741,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
             0 => {}
             _ => {
                 row.push_str("--");
-                row.push_str(&long_name[]);
+                row.push_str(&long_name[..]);
                 row.push(' ');
             }
         }
@@ -749,10 +749,10 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
         // arg
         match hasarg {
             No => {}
-            Yes => row.push_str(&hint[]),
+            Yes => row.push_str(&hint[..]),
             Maybe => {
                 row.push('[');
-                row.push_str(&hint[]);
+                row.push_str(&hint[..]);
                 row.push(']');
             }
         }
@@ -765,7 +765,7 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
                 row.push(' ');
             }
         } else {
-            row.push_str(&desc_sep[]);
+            row.push_str(&desc_sep[..]);
         }
 
         // Normalize desc to contain words separated by one space character
@@ -777,14 +777,14 @@ pub fn usage(brief: &str, opts: &[OptGroup]) -> String {
 
         // FIXME: #5516 should be graphemes not codepoints
         let mut desc_rows = Vec::new();
-        each_split_within(&desc_normalized_whitespace[], 54, |substr| {
+        each_split_within(&desc_normalized_whitespace[..], 54, |substr| {
             desc_rows.push(substr.to_string());
             true
         });
 
         // FIXME: #5516 should be graphemes not codepoints
         // wrapped description
-        row.push_str(&desc_rows.connect(&desc_sep[])[]);
+        row.push_str(&desc_rows.connect(&desc_sep[..])[]);
 
         row
     });
@@ -803,10 +803,10 @@ fn format_option(opt: &OptGroup) -> String {
     // Use short_name is possible, but fallback to long_name.
     if opt.short_name.len() > 0 {
         line.push('-');
-        line.push_str(&opt.short_name[]);
+        line.push_str(&opt.short_name[..]);
     } else {
         line.push_str("--");
-        line.push_str(&opt.long_name[]);
+        line.push_str(&opt.long_name[..]);
     }
 
     if opt.hasarg != No {
@@ -814,7 +814,7 @@ fn format_option(opt: &OptGroup) -> String {
         if opt.hasarg == Maybe {
             line.push('[');
         }
-        line.push_str(&opt.hint[]);
+        line.push_str(&opt.hint[..]);
         if opt.hasarg == Maybe {
             line.push(']');
         }
@@ -836,7 +836,7 @@ pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String {
     line.push_str(&opts.iter()
                        .map(format_option)
                        .collect::<Vec<String>>()
-                       .connect(" ")[]);
+                       .connect(" ")[..]);
     line
 }