diff options
author | Jan-Erik Rediger <janerik@fnordig.de> | 2021-04-06 14:03:53 +0200 |
---|---|---|
committer | Jan-Erik Rediger <janerik@fnordig.de> | 2021-04-06 14:03:59 +0200 |
commit | 5327e3bdf94e5c12a19f8a05a03c002869479c7b (patch) | |
tree | fca18012d209c940637ea7fab540e477e8051fc8 | |
parent | d10ed3c1b1143b8bc02a99166858c8e513286a5c (diff) |
Follow clippy recommendations
-rw-r--r-- | src/bin/mdbook-mermaid.rs | 12 | ||||
-rw-r--r-- | src/lib.rs | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/bin/mdbook-mermaid.rs b/src/bin/mdbook-mermaid.rs index e1ff399..7092825 100644 --- a/src/bin/mdbook-mermaid.rs +++ b/src/bin/mdbook-mermaid.rs @@ -47,11 +47,9 @@ fn main() { handle_supports(sub_args); } else if let Some(sub_args) = matches.subcommand_matches("install") { handle_install(sub_args); - } else { - if let Err(e) = handle_preprocessing() { - eprintln!("{}", e); - process::exit(1); - } + } else if let Err(e) = handle_preprocessing() { + eprintln!("{}", e); + process::exit(1); } } @@ -211,7 +209,7 @@ fn add_preprocessor(doc: &mut Document) { .as_table_mut() .unwrap() .entry("mermaid") - .or_insert(empty_table.clone()); + .or_insert(empty_table); item["command"] = value("mdbook-mermaid"); } @@ -235,7 +233,7 @@ fn insert_additional(doc: &mut Document, additional_type: &str, file: &str) { .as_table_mut() .unwrap() .entry("html") - .or_insert(empty_table.clone()); + .or_insert(empty_table); let array = item .as_table_mut() .unwrap() @@ -94,8 +94,10 @@ fn add_mermaid(content: &str) -> Result<String> { None }); let events = events.filter_map(|e| e); - let mut opts = COptions::default(); - opts.newlines_after_codeblock = 1; + let opts = COptions { + newlines_after_codeblock: 1, + ..Default::default() + }; cmark_with_options(events, &mut buf, None, opts) .map(|_| buf) .map_err(|err| Error::msg(format!("Markdown serialization failed: {}", err))) |