mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 18:54:32 -06:00
Remove some multiple newlines
This commit is contained in:
@@ -11,13 +11,11 @@ use std::collections::BTreeMap;
|
||||
|
||||
use regex::Regex;
|
||||
|
||||
|
||||
static PATTERNS: &'static [(&'static str, &'static str)] = &[
|
||||
(r"ch(\d\d)-\d\d-.*\.md", "chapter$1.md"),
|
||||
(r"appendix-(\d\d).*\.md", "appendix.md"),
|
||||
];
|
||||
|
||||
|
||||
lazy_static! {
|
||||
static ref MATCHERS: Vec<(Regex, &'static str)> = {
|
||||
PATTERNS.iter()
|
||||
@@ -26,7 +24,6 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
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)> {
|
||||
read_dir(source_dir)
|
||||
.expect("Unable to read source directory")
|
||||
@@ -69,7 +64,6 @@ fn match_files(source_dir: &Path, target_dir: &Path) -> Vec<(PathBuf, PathBuf)>
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
fn group_by_target(matched_files: Vec<(PathBuf, PathBuf)>) -> BTreeMap<PathBuf, Vec<PathBuf>> {
|
||||
let mut grouped: BTreeMap<PathBuf, Vec<PathBuf>> = BTreeMap::new();
|
||||
for (source, target) in matched_files {
|
||||
@@ -83,7 +77,6 @@ fn group_by_target(matched_files: Vec<(PathBuf, PathBuf)>) -> BTreeMap<PathBuf,
|
||||
grouped
|
||||
}
|
||||
|
||||
|
||||
fn concat_files(source_paths: Vec<PathBuf>, target_path: PathBuf) -> io::Result<()> {
|
||||
println!("Concatenating into {}:", target_path.to_string_lossy());
|
||||
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(())
|
||||
}
|
||||
|
||||
|
||||
fn ensure_dir_exists(dir_string: &str) -> io::Result<&Path> {
|
||||
let path = Path::new(dir_string);
|
||||
if !path.exists() {
|
||||
|
||||
Reference in New Issue
Block a user