Remove some multiple newlines

This commit is contained in:
Carol (Nichols || Goulding)
2016-08-16 09:19:11 -04:00
parent cfabd86e21
commit 8a265a68fc
-8
View File
@@ -11,13 +11,11 @@ use std::collections::BTreeMap;
use regex::Regex; use regex::Regex;
static PATTERNS: &'static [(&'static str, &'static str)] = &[ static PATTERNS: &'static [(&'static str, &'static str)] = &[
(r"ch(\d\d)-\d\d-.*\.md", "chapter$1.md"), (r"ch(\d\d)-\d\d-.*\.md", "chapter$1.md"),
(r"appendix-(\d\d).*\.md", "appendix.md"), (r"appendix-(\d\d).*\.md", "appendix.md"),
]; ];
lazy_static! { lazy_static! {
static ref MATCHERS: Vec<(Regex, &'static str)> = { static ref MATCHERS: Vec<(Regex, &'static str)> = {
PATTERNS.iter() PATTERNS.iter()
@@ -26,7 +24,6 @@ lazy_static! {
}; };
} }
fn main() { fn main() {
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
@@ -46,8 +43,6 @@ fn main() {
} }
} }
fn match_files(source_dir: &Path, target_dir: &Path) -> Vec<(PathBuf, PathBuf)> { fn match_files(source_dir: &Path, target_dir: &Path) -> Vec<(PathBuf, PathBuf)> {
read_dir(source_dir) read_dir(source_dir)
.expect("Unable to read source directory") .expect("Unable to read source directory")
@@ -69,7 +64,6 @@ fn match_files(source_dir: &Path, target_dir: &Path) -> Vec<(PathBuf, PathBuf)>
.collect() .collect()
} }
fn group_by_target(matched_files: Vec<(PathBuf, PathBuf)>) -> BTreeMap<PathBuf, Vec<PathBuf>> { fn group_by_target(matched_files: Vec<(PathBuf, PathBuf)>) -> BTreeMap<PathBuf, Vec<PathBuf>> {
let mut grouped: BTreeMap<PathBuf, Vec<PathBuf>> = BTreeMap::new(); let mut grouped: BTreeMap<PathBuf, Vec<PathBuf>> = BTreeMap::new();
for (source, target) in matched_files { for (source, target) in matched_files {
@@ -83,7 +77,6 @@ fn group_by_target(matched_files: Vec<(PathBuf, PathBuf)>) -> BTreeMap<PathBuf,
grouped grouped
} }
fn concat_files(source_paths: Vec<PathBuf>, target_path: PathBuf) -> io::Result<()> { fn concat_files(source_paths: Vec<PathBuf>, target_path: PathBuf) -> io::Result<()> {
println!("Concatenating into {}:", target_path.to_string_lossy()); println!("Concatenating into {}:", target_path.to_string_lossy());
let mut target = try!(File::create(target_path)); let mut target = try!(File::create(target_path));
@@ -104,7 +97,6 @@ fn concat_files(source_paths: Vec<PathBuf>, target_path: PathBuf) -> io::Result<
Ok(()) Ok(())
} }
fn ensure_dir_exists(dir_string: &str) -> io::Result<&Path> { fn ensure_dir_exists(dir_string: &str) -> io::Result<&Path> {
let path = Path::new(dir_string); let path = Path::new(dir_string);
if !path.exists() { if !path.exists() {