Skip to content

Commit

Permalink
Fixed clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
saschagrunert committed May 3, 2017
1 parent 53ec0e2 commit 2f74cde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
}

Expand All @@ -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),
}
}
}
Expand All @@ -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),
}
}
}
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 2f74cde

Please sign in to comment.