From 1d97f39da12616d33de992916379d55ff5387f2d Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sat, 5 Nov 2022 22:00:21 -0700 Subject: [PATCH] cleanup: avoid an unnecessary `Box` for argument to formatter I think this cleanup was enabled by a recent refactoring that replaced a trait object by a type parameter (3392e834863e). --- src/template_parser.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/template_parser.rs b/src/template_parser.rs index bf847eb73..53019846b 100644 --- a/src/template_parser.rs +++ b/src/template_parser.rs @@ -355,12 +355,9 @@ fn parse_commit_term<'a>( let content: Box + 'a> = parse_commit_template_rule(repo, workspace_id, arg_template); let get_labels = move |commit: &Commit| -> String { - let mut buf: Vec = vec![]; - { - let writer = Box::new(&mut buf); - let mut formatter = PlainTextFormatter::new(writer); - label_template.format(commit, &mut formatter).unwrap(); - } + let mut buf = vec![]; + let mut formatter = PlainTextFormatter::new(&mut buf); + label_template.format(commit, &mut formatter).unwrap(); String::from_utf8(buf).unwrap() }; Box::new(DynamicLabelTemplate::new(content, Box::new(get_labels)))