mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-28 09:14:04 +00:00
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 (3392e83486
).
This commit is contained in:
parent
2681e8f908
commit
1d97f39da1
1 changed files with 3 additions and 6 deletions
|
@ -355,12 +355,9 @@ fn parse_commit_term<'a>(
|
|||
let content: Box<dyn Template<Commit> + 'a> =
|
||||
parse_commit_template_rule(repo, workspace_id, arg_template);
|
||||
let get_labels = move |commit: &Commit| -> String {
|
||||
let mut buf: Vec<u8> = 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)))
|
||||
|
|
Loading…
Reference in a new issue