mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
Merge pull request #113 from kbknapp/dev
chore(Rust): removes use of + with Vec<T>
This commit is contained in:
commit
6e75ce6d5a
1 changed files with 11 additions and 2 deletions
13
src/app.rs
13
src/app.rs
|
@ -737,7 +737,13 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
||||||
if g_vec.is_empty() {
|
if g_vec.is_empty() {
|
||||||
return args.iter().map(|s| s.to_owned()).collect()
|
return args.iter().map(|s| s.to_owned()).collect()
|
||||||
}
|
}
|
||||||
return g_vec.iter().map(|g| self.get_group_members(g)).fold(vec![], |acc, v| acc + &v)
|
return g_vec.iter()
|
||||||
|
.map(|g| self.get_group_members(g))
|
||||||
|
.fold(vec![], |mut acc, v| {
|
||||||
|
v.into_iter().map(|i| acc.push(i)).collect::<Vec<_>>();
|
||||||
|
acc
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_group_members_names(&self, group: &'ar str) -> Vec<&'ar str> {
|
fn get_group_members_names(&self, group: &'ar str) -> Vec<&'ar str> {
|
||||||
|
@ -763,7 +769,10 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
|
||||||
}
|
}
|
||||||
return g_vec.iter()
|
return g_vec.iter()
|
||||||
.map(|g| self.get_group_members_names(g))
|
.map(|g| self.get_group_members_names(g))
|
||||||
.fold(vec![], |acc, v| acc + &v)
|
.fold(vec![], |mut acc, v| {
|
||||||
|
v.into_iter().map(|i| acc.push(i)).collect::<Vec<_>>();
|
||||||
|
acc
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_required_from(&self, reqs: HashSet<&'ar str>) -> VecDeque<String> {
|
fn get_required_from(&self, reqs: HashSet<&'ar str>) -> VecDeque<String> {
|
||||||
|
|
Loading…
Reference in a new issue