summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2024-04-24 21:36:03 +0200
committerJoel Klinghed <the_jk@spawned.biz>2024-04-24 21:36:03 +0200
commitc0bf5db3c0c4052526d5234144346f3caf767ef9 (patch)
tree9ddb34753116d592fdec86b1e3a5622c8e116a91
parent5548c9f4a234db1819cf912d42664b5eb83c2de9 (diff)
args: Fix order in LongOnlyParser#print_help
Use options for iter as the order is stable (not true for long hash map)
-rw-r--r--src/args.rs3
1 files changed, 1 insertions, 2 deletions
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),