|
@@ -108,17 +108,16 @@ fn build() {
|
108
|
108
|
.expect("Couldn't find post listing item template");
|
109
|
109
|
|
110
|
110
|
let post_paths = read_posts_dir(&cwd.join("posts"));
|
111
|
|
- let mut posts: Vec<Post> = vec![];
|
112
|
|
- for path in post_paths {
|
113
|
|
- match path {
|
|
111
|
+ let posts = post_paths
|
|
112
|
+ .into_iter()
|
|
113
|
+ .map(|path| match path {
|
114
|
114
|
Ok(p) => {
|
115
|
115
|
let post = parse_post(p.path());
|
116
|
116
|
render_post(&cwd, &layout_template, &post_template, &post);
|
117
|
|
- posts.push(post);
|
|
117
|
+ post
|
118
|
118
|
}
|
119
|
119
|
Err(err) => panic!(err),
|
120
|
|
- }
|
121
|
|
- }
|
|
120
|
+ }).collect();
|
122
|
121
|
|
123
|
122
|
render_post_listing(&cwd, &layout_template, &post_item_template, &posts);
|
124
|
123
|
}
|