Skip to content

Commit 2923924

Browse files
mlcui-corparxanas
authored andcommitted
cleanup(reword): Remove redundant reassignment in edit_message
Both arms of the match results in a `&mut Editor` pointing to the same editor, which is redundant.
1 parent f1c1aa5 commit 2923924

File tree

1 file changed

+7
-4
lines changed
  • git-branchless-reword/src

1 file changed

+7
-4
lines changed

git-branchless-reword/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ pub enum InitialCommitMessages {
6161
/// Open the user's configured commit editor seeded with the provided message.
6262
#[instrument]
6363
pub fn edit_message(git_run_info: &GitRunInfo, repo: &Repo, message: &str) -> eyre::Result<String> {
64-
let mut editor = Editor::new();
65-
let (editor, editor_program) = match get_editor(git_run_info, repo)? {
66-
Some(editor_program) => (editor.executable(&editor_program), editor_program),
67-
None => (&mut editor, "<default>".into()),
64+
let (mut editor, editor_program) = match get_editor(git_run_info, repo)? {
65+
Some(editor_program) => {
66+
let mut editor = Editor::new();
67+
editor.executable(&editor_program);
68+
(editor, editor_program)
69+
}
70+
None => (Editor::new(), "<default>".into()),
6871
};
6972
if editor_program == ":" {
7073
// Special case in Git: treat `:` as a no-op editor.

0 commit comments

Comments
 (0)