From c0bf5db3c0c4052526d5234144346f3caf767ef9 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 24 Apr 2024 21:36:03 +0200 Subject: args: Fix order in LongOnlyParser#print_help Use options for iter as the order is stable (not true for long hash map) --- src/args.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/args.rs b/src/args.rs index 31bd470..0014d66 100644 --- a/src/args.rs +++ b/src/args.rs @@ -183,8 +183,7 @@ impl Parser for LongOnlyParser { fn print_help(&self, options: &Options) { let mut lines = Vec::new(); - for (_, index) in &options.long { - let ref option = options[*index]; + for option in &options.options { let left = match option.value_req { ValueRequirement::None => format!("-{}", option.long()), ValueRequirement::Required(name) => format!("-{}={}", option.long(), name), -- cgit v1.2.3-70-g09d2