misc

Misc scripts and tools
git clone git://git.alexwennerberg.com/misc
Log | Files | Refs | README | LICENSE

commit 38145fafbe0f46e125dcf1b174e8dd9fcafac4e9
parent 66279df376edb0cafae1cd158a8e300c98783ac7
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon, 19 Jul 2021 21:18:33 -0700

Cleanup arg.rs

remove unneccesary allocation
remove unused line of code

Diffstat:
Marg.rs | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arg.rs b/arg.rs @@ -24,10 +24,8 @@ fn main() { let args: Vec<String> = env::args().collect(); for mut n in 1..args.len() { - let arg: Vec<char> = args[n].chars().collect(); - if arg.len() > 1 && arg[0] == '-' { - let mut iter = arg.iter(); - iter.next(); + let mut iter = args[n].chars(); + if iter.next() == Some('-') { for m in iter { // Match your variables here (only supports single-char vars) match m { @@ -48,7 +46,6 @@ fn main() { } } } - arg[0]; } else { positional = Some(&args[n]); }