From 8bbfe9731e91e8b7a9205d6c359129b0831e31af Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 11 Oct 2021 12:52:57 -0700 Subject: [PATCH] cleanup: let newer Clippy fix a few things it found --- lib/src/simple_op_store.rs | 2 +- src/commands.rs | 4 +--- src/template_parser.rs | 11 +++++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/src/simple_op_store.rs b/lib/src/simple_op_store.rs index 4bb1d379f..b0f3dae5a 100644 --- a/lib/src/simple_op_store.rs +++ b/lib/src/simple_op_store.rs @@ -254,7 +254,7 @@ fn view_from_proto(proto: &crate::protos::op_store::View) -> View { let local_target = branch_proto .local_target .as_ref() - .map(|ref_target_proto| ref_target_from_proto(ref_target_proto)); + .map(ref_target_from_proto); let mut remote_targets = BTreeMap::new(); for remote_branch in branch_proto.remote_branches.iter() { diff --git a/src/commands.rs b/src/commands.rs index a6873fdea..e05b021f5 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -2242,9 +2242,7 @@ fn edit_description(repo: &ReadonlyRepo, description: &str) -> String { .arg(&description_file_path) .status() .expect("failed to run editor"); - if !exit_status.success() { - panic!("failed to run editor"); - } + assert!(exit_status.success(), "failed to run editor"); let mut description_file = OpenOptions::new() .read(true) diff --git a/src/template_parser.rs b/src/template_parser.rs index e6fa8cebf..fb5d1d678 100644 --- a/src/template_parser.rs +++ b/src/template_parser.rs @@ -412,12 +412,11 @@ pub fn parse_commit_template<'a>( let first_pair = pairs.next().unwrap(); assert!(pairs.next().is_none()); - if first_pair.as_span().end() != template_text.len() { - panic!( - "failed to parse template past position {}", - first_pair.as_span().end() - ); - } + assert!( + !(first_pair.as_span().end() != template_text.len()), + "failed to parse template past position {}", + first_pair.as_span().end() + ); parse_commit_template_rule(repo, first_pair) }