summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Grunert <mail@saschagrunert.de>2017-05-03 19:09:09 +0200
committerSascha Grunert <mail@saschagrunert.de>2017-05-03 19:11:30 +0200
commit2f74cdeb28e4f14de6e17bcd289da82ecf132586 (patch)
tree4935a78be2bb3d10fc765ed9ad202ab1a164a18a
parent53ec0e2c6e3fcd5a4779a1b2db2bb1139a2a8f7f (diff)
Fixed clippy lints1.5.0
-rw-r--r--src/main.rs10
-rw-r--r--src/parser.rs5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 61d28c6..360d74f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,7 +14,7 @@ use clap::{App, Shell};
use gitjournal::GitJournal;
use gitjournal::errors::*;
-fn error_and_exit(string: &str, error: Error) {
+fn error_and_exit(string: &str, error: &Error) {
error!("{}: {}", string, error);
exit(1);
}
@@ -33,7 +33,7 @@ fn is_program_in_path(program: &str) -> bool {
fn main() {
if let Err(error) = run() {
- error_and_exit("Main", error);
+ error_and_exit("Main", &error);
}
}
@@ -55,7 +55,7 @@ fn run() -> Result<()> {
match journal.prepare(sub_matches.value_of("message").ok_or_else(|| "No CLI 'message' provided")?,
sub_matches.value_of("type")) {
Ok(()) => info!("Commit message prepared."),
- Err(error) => error_and_exit("Commit message preparation failed", error),
+ Err(error) => error_and_exit("Commit message preparation failed", &error),
}
}
}
@@ -82,7 +82,7 @@ fn run() -> Result<()> {
if let Some(sub_matches) = matches.subcommand_matches("verify") {
match journal.verify(sub_matches.value_of("message").ok_or_else(|| "No CLI 'message' provided")?) {
Ok(()) => info!("Commit message valid."),
- Err(error) => error_and_exit("Commit message invalid", error),
+ Err(error) => error_and_exit("Commit message invalid", &error),
}
}
}
@@ -100,7 +100,7 @@ fn run() -> Result<()> {
&max_tags,
&matches.is_present("all"),
&matches.is_present("skip_unreleased")) {
- error_and_exit("Log parsing error", error);
+ error_and_exit("Log parsing error", &error);
}
// Generate the template or print the log
diff --git a/src/parser.rs b/src/parser.rs
index 542c44d..f6ceea3 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -875,9 +875,10 @@ impl Parser {
// Do nothing on comments and empty parts
if RE_COMMENT.is_match(part) || part.is_empty() {
continue;
+ }
- // Parse the footer
- } else if RE_FOOTER.is_match(part) {
+ // Parse the footer
+ if RE_FOOTER.is_match(part) {
for cap in RE_FOOTER.captures_iter(part) {
let key = cap.get(1)
.map(|k| k.as_str())