message: refactor: Remove deep nesting
diff: @@ -360,10 +360,18 @@ pub fn build(config: &Config) -> Result<()> {
  // creates a new RSS file with the contents of the site blog
  fn create_rss(path: &str, dest: &Path, config: &Config, posts: &[Document]) -> Result<()> {
  - match (&config.name, &config.description, &config.link) {
  - // these three fields are mandatory in the RSS standard
  - (&Some(ref name), &Some(ref description), &Some(ref link)) => {
  - trace!("Generating RSS data");
  + let name = config
  + .name
  + .as_ref()
  + .ok_or(ErrorKind::ConfigFileMissingFields)?;
  + let description = config
  + .description
  + .as_ref()
  + .ok_or(ErrorKind::ConfigFileMissingFields)?;
  + let link = config
  + .link
  + .as_ref()
  + .ok_or(ErrorKind::ConfigFileMissingFields)?;
  let items: Result<Vec<rss::Item>> = posts.iter().map(|doc| doc.to_rss(link)).collect();
  let items = items?;
  @@ -389,14 +397,20 @@ fn create_rss(path: &str, dest: &Path, config: &Config, posts: &[Document]) -> R
  info!("Created RSS file at {}", rss_path.display());
  Ok(())
  }
  - _ => Err(ErrorKind::ConfigFileMissingFields.into()),
  - }
  -}
  // creates a new jsonfeed file with the contents of the site blog
  fn create_jsonfeed(path: &str, dest: &Path, config: &Config, posts: &[Document]) -> Result<()> {
  - match (&config.name, &config.description, &config.link) {
  - (&Some(ref name), &Some(ref desc), &Some(ref link)) => {
  - trace!("Generating jsonfeed data");
  + let name = config
  + .name
  + .as_ref()
  + .ok_or(ErrorKind::ConfigFileMissingFields)?;
  + let description = config
  + .description
  + .as_ref()
  + .ok_or(ErrorKind::ConfigFileMissingFields)?;
  + let link = config
  + .link
  + .as_ref()
  + .ok_or(ErrorKind::ConfigFileMissingFields)?;
  let jsonitems = posts.iter().map(|doc| doc.to_jsonfeed(link)).collect();
  @@ -404,7 +418,7 @@ fn create_jsonfeed(path: &str, dest: &Path, config: &Config, posts: &[Document])
  title: name.to_string(),
  items: jsonitems,
  home_page_url: Some(link.to_string()),
  - description: Some(desc.to_string()),
  + description: Some(description.to_string()),
  ..Default::default()
  };
  @@ -416,9 +430,6 @@ fn create_jsonfeed(path: &str, dest: &Path, config: &Config, posts: &[Document])
  info!("Created jsonfeed file at {}", jsonfeed_path.display());
  Ok(())
  }
  - _ => Err(ErrorKind::ConfigFileMissingFields.into()),
  - }
  -}
  fn compile_sass<S: AsRef<Path>, D: AsRef<Path>, F: AsRef<Path>>(config: &Config,
  source: S,
  @@ -456,7 +467,11 @@ fn compile_sass_internal(config: &Config,
  }
  #[cfg(not(feature = "sass"))]
  -fn compile_sass_internal(_config: &Config, source: &Path, dest: &Path, file_path: &Path) -> Result<()> {
  +fn compile_sass_internal(_config: &Config,
  + source: &Path,
  + dest: &Path,
  + file_path: &Path)
  + -> Result<()> {
  let src_file = source.join(file_path);
  copy_file(src_file.as_path(), dest.join(file_path).as_path())
  }
  