Skip to content

Commit

Permalink
Merge pull request #113 from kbknapp/dev
Browse files Browse the repository at this point in the history
chore(Rust): removes use of + with Vec<T>
  • Loading branch information
kbknapp committed May 9, 2015
2 parents 58c8e2d + da78da3 commit 6e75ce6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,13 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
if g_vec.is_empty() {
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> {
Expand All @@ -763,7 +769,10 @@ impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>{
}
return g_vec.iter()
.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> {
Expand Down

0 comments on commit 6e75ce6

Please sign in to comment.