From 0859cf6b116b1a9c226a8c9ae81d7e9b0547d860 Mon Sep 17 00:00:00 2001 From: Martin Frost Date: Mon, 16 May 2022 13:31:00 +0200 Subject: [PATCH] Make clippy happy with Rust 1.60 --- src/bin/git-edit-coauthor.rs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/bin/git-edit-coauthor.rs b/src/bin/git-edit-coauthor.rs index 22491a5..60d2388 100644 --- a/src/bin/git-edit-coauthor.rs +++ b/src/bin/git-edit-coauthor.rs @@ -20,24 +20,22 @@ fn main() { let opt = Opt::parse(); let mut authors = get_available_coauthors(); - let mut updated_author: Author; if let Some(author) = authors.get(&opt.initials) { - updated_author = author.clone(); + let mut updated_author: Author = author.clone(); + if let Some(name) = opt.name { + updated_author.name = name; + }; + + if let Some(email) = opt.email { + updated_author.email = email; + }; + + authors.insert(opt.initials, updated_author); + + write_coauthors_file(authors); } else { eprintln!("No author found with initials {}", &opt.initials); process::exit(1); - } - - if let Some(name) = opt.name { - updated_author.name = name; - } - - if let Some(email) = opt.email { - updated_author.email = email; - } - - authors.insert(opt.initials, updated_author); - - write_coauthors_file(authors); + }; }