]> git.lizzy.rs Git - rust.git/commitdiff
Use byte literals in libgetopts
authornham <hamann.nick@gmail.com>
Wed, 6 Aug 2014 17:06:37 +0000 (13:06 -0400)
committernham <hamann.nick@gmail.com>
Wed, 6 Aug 2014 17:06:37 +0000 (13:06 -0400)
src/libgetopts/lib.rs

index 922bf768854ea3d6c184015ea0feecc911e8353a..65ae18e8361bcb5623cf8dcf93bfe411c583af06 100644 (file)
@@ -372,7 +372,7 @@ pub fn opt_default(&self, nm: &str, def: &str) -> Option<String> {
 }
 
 fn is_arg(arg: &str) -> bool {
-    arg.len() > 1 && arg.as_bytes()[0] == '-' as u8
+    arg.len() > 1 && arg.as_bytes()[0] == b'-'
 }
 
 fn find_opt(opts: &[Opt], nm: Name) -> Option<uint> {
@@ -555,7 +555,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
         } else {
             let mut names;
             let mut i_arg = None;
-            if cur.as_bytes()[1] == '-' as u8 {
+            if cur.as_bytes()[1] == b'-' {
                 let tail = cur.as_slice().slice(2, curlen);
                 let tail_eq: Vec<&str> = tail.split('=').collect();
                 if tail_eq.len() <= 1 {