Add Clone trait bound to write_list
This commit is contained in:
parent
cfec7ad593
commit
2dd8d6d097
@ -1707,7 +1707,7 @@ impl Rewrite for ast::Arm {
|
||||
ends_with_newline: false,
|
||||
config: context.config,
|
||||
};
|
||||
let pats_str = try_opt!(write_list(items, &fmt));
|
||||
let pats_str = try_opt!(write_list(&items, &fmt));
|
||||
|
||||
let guard_shape = if pats_str.contains('\n') {
|
||||
shape.with_max_width(context.config)
|
||||
|
@ -478,7 +478,7 @@ impl<'a> FmtVisitor<'a> {
|
||||
config: self.config,
|
||||
};
|
||||
|
||||
let list = try_opt!(write_list(items, &fmt));
|
||||
let list = try_opt!(write_list(&items.collect::<Vec<_>>(), &fmt));
|
||||
result.push_str(&list);
|
||||
result.push('\n');
|
||||
Some(result)
|
||||
@ -2539,7 +2539,7 @@ fn rewrite_where_clause_rfc_style(
|
||||
ends_with_newline: true,
|
||||
config: context.config,
|
||||
};
|
||||
let preds_str = try_opt!(write_list(items, &fmt));
|
||||
let preds_str = try_opt!(write_list(&items.collect::<Vec<_>>(), &fmt));
|
||||
|
||||
Some(format!(
|
||||
"{}where\n{}{}",
|
||||
|
@ -157,7 +157,7 @@ where
|
||||
// TODO: add unit tests
|
||||
pub fn write_list<I, T>(items: I, formatting: &ListFormatting) -> Option<String>
|
||||
where
|
||||
I: IntoIterator<Item = T>,
|
||||
I: IntoIterator<Item = T> + Clone,
|
||||
T: AsRef<ListItem>,
|
||||
{
|
||||
let tactic = formatting.tactic;
|
||||
|
Loading…
x
Reference in New Issue
Block a user