@@ -66,7 +66,7 @@ pub fn report_elapsed_time(instant: Instant) { | |||||
/// Display an error message and the actual error(s) | /// Display an error message and the actual error(s) | ||||
pub fn unravel_errors(message: &str, error: &Error) { | pub fn unravel_errors(message: &str, error: &Error) { | ||||
if message.len() > 0 { | |||||
if !message.is_empty() { | |||||
self::error(message); | self::error(message); | ||||
} | } | ||||
self::error(&format!("Error: {}", error)); | self::error(&format!("Error: {}", error)); | ||||
@@ -14,7 +14,7 @@ pub fn create_file(path: &Path, content: &str) -> Result<()> { | |||||
/// Create a directory at the given path if it doesn't exist already | /// Create a directory at the given path if it doesn't exist already | ||||
pub fn ensure_directory_exists(path: &Path) -> Result<()> { | pub fn ensure_directory_exists(path: &Path) -> Result<()> { | ||||
if !path.exists() { | if !path.exists() { | ||||
create_directory(&path)?; | |||||
create_directory(path)?; | |||||
} | } | ||||
Ok(()) | Ok(()) | ||||
} | } | ||||
@@ -181,7 +181,7 @@ impl Site { | |||||
/// Defaults to `AnchorInsert::None` if no parent section found | /// Defaults to `AnchorInsert::None` if no parent section found | ||||
pub fn find_parent_section_insert_anchor(&self, parent_path: &PathBuf) -> InsertAnchor { | pub fn find_parent_section_insert_anchor(&self, parent_path: &PathBuf) -> InsertAnchor { | ||||
match self.sections.get(&parent_path.join("_index.md")) { | match self.sections.get(&parent_path.join("_index.md")) { | ||||
Some(ref s) => s.meta.insert_anchor.unwrap(), | |||||
Some(s) => s.meta.insert_anchor.unwrap(), | |||||
None => InsertAnchor::None | None => InsertAnchor::None | ||||
} | } | ||||
} | } | ||||