Update parsing for package declarations (#9)

Use `filter` instead of `take_while` to find all cargo-play
declarations.
This commit is contained in:
Ashkan Kiani 2019-07-28 17:27:37 -07:00 committed by Zeyi Fan
parent 3d1f7c81ef
commit 21d51d5b2e

View file

@ -36,7 +36,7 @@ fn extract_headers(files: &Vec<String>) -> Vec<String> {
.iter()
.map(|file: &String| -> Vec<String> {
file.lines()
.take_while(|line| line.starts_with("//#"))
.filter(|line| line.starts_with("//#"))
.map(|line| line[3..].trim_start().into())
.filter(|s: &String| !s.is_empty())
.collect()