Skip to content

Commit

Permalink
Use splitn on the category slug/display name pairs
Browse files Browse the repository at this point in the history
  • Loading branch information
carols10cents committed Nov 29, 2016
1 parent d8d19ec commit 8db77c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ pub fn sync() -> CargoResult<()> {
let categories = include_str!("./categories.txt");

let slug_categories: Vec<_> = categories.lines().map(|c| {
let mut parts = c.split(' ');
let mut parts = c.splitn(2, ' ');
let slug = parts.next().expect("No slug found!");
let name = parts.collect::<Vec<_>>().join(" ");
let name = parts.next().expect("No display name found!");
(slug, name)
}).collect();

Expand Down

0 comments on commit 8db77c4

Please sign in to comment.