Fix clippy issues.
All checks were successful
rust-test Build rust-test has succeeded
rust-clippy Build rust-clippy has succeeded
build-natter Build build-natter has succeeded
format Build format has succeeded

This commit is contained in:
Tom Alexander
2023-12-23 06:38:23 -05:00
parent 818fca87f2
commit 397d4ea0bc
20 changed files with 42 additions and 73 deletions

View File

@@ -47,8 +47,7 @@ impl Config {
}
pub(crate) fn get_root_directory(&self) -> &Path {
&self
.config_path
self.config_path
.parent()
.expect("Config file must exist inside a directory.")
}
@@ -86,8 +85,7 @@ impl Config {
self.raw
.stream
.as_ref()
.map(|stream| stream.entries_per_page)
.flatten()
.and_then(|stream| stream.entries_per_page)
.unwrap_or(5)
}
}

View File

@@ -2,7 +2,7 @@ use serde::Deserialize;
use serde::Serialize;
/// This is the struct for the natter.toml config file that ends up in each site's root directory.
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize, Default)]
pub(crate) struct RawConfig {
pub(super) site_title: Option<String>,
author: Option<String>,
@@ -12,28 +12,7 @@ pub(crate) struct RawConfig {
pub(super) stream: Option<RawConfigStream>,
}
impl Default for RawConfig {
fn default() -> Self {
RawConfig {
site_title: None,
author: None,
email: None,
use_relative_paths: None,
web_root: None,
stream: None,
}
}
}
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize, Default)]
pub(crate) struct RawConfigStream {
pub(super) entries_per_page: Option<usize>,
}
impl Default for RawConfigStream {
fn default() -> Self {
RawConfigStream {
entries_per_page: None,
}
}
}