Skip to content

Commit

Permalink
fix: fix linting and docs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Nov 12, 2023
1 parent 4f8de64 commit d60c36c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions argh_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,18 +427,22 @@ fn impl_from_args_struct_from_args<'a>(
method_impl
}

/// get help triggers vector from type_attrs.help_triggers as a Vec<String>
/// get help triggers vector from type_attrs.help_triggers as a [`Vec<String>`]
///
/// Defaults to vec!["--help", "help"] if type_attrs.help_triggers is None
fn get_help_triggers(type_attrs: &TypeAttrs) -> Vec<String> {
let help_triggers = type_attrs.help_triggers.as_ref().map_or_else(
|| vec!["--help".to_owned(), "help".to_owned()],
|s| {
s.into_iter()
s.iter()
.filter_map(|s| {
let trigger = s.value();
let trigger_trimmed = trigger.trim().to_owned();
return if trigger_trimmed.is_empty() { None } else { Some(trigger_trimmed) };
if trigger_trimmed.is_empty() {
None
} else {
Some(trigger_trimmed)
}
})
.collect::<Vec<_>>()
},
Expand Down

0 comments on commit d60c36c

Please sign in to comment.