1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-09-28 07:09:40 +02:00

add some Default() implementations

https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
This commit is contained in:
stefan0xC 2022-03-01 00:18:00 +01:00
parent e27403458c
commit dd3bddb88c
5 changed files with 36 additions and 0 deletions

View File

@ -1716,6 +1716,12 @@ impl Book {
}
}
impl std::default::Default for Book {
fn default() -> Self {
Self::new()
}
}
/// Calls mustache::compile_str but catches panics and returns a result
pub fn compile_str<O>(template: &str, source: O, template_name: &str) -> Result<mustache::Template>
where

View File

@ -56,6 +56,12 @@ impl Bars {
}
}
impl Default for Bars {
fn default() -> Self {
Self::new()
}
}
/// Return the style of a bar
impl Book {

View File

@ -1088,3 +1088,9 @@ impl BookOptions {
out
}
}
impl Default for BookOptions {
fn default() -> Self {
Self::new()
}
}

View File

@ -67,6 +67,12 @@ impl Features {
}
}
impl Default for Features {
fn default() -> Self {
Self::new()
}
}
impl BitOr for Features {
type Output = Self;
@ -395,6 +401,12 @@ impl Parser {
}
}
impl Default for Parser {
fn default() -> Self {
Self::new()
}
}
/// Replace consecutives Strs by a Str of both, collapse soft breaks to previous std and so on
fn collapse(ast: &mut Vec<Token>) {
let mut i = 0;

View File

@ -236,6 +236,12 @@ impl ResourceHandler {
}
}
impl Default for ResourceHandler {
fn default() -> Self {
Self::new()
}
}
/// Get the list of all files, walking recursively in directories
///
/// # Arguments