Skip to content

Commit 1e7878f

Browse files
committed
FIX: Use dyn FnMut for element format closure
1 parent ddfb349 commit 1e7878f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/arrayformat.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,14 @@ impl FormatOptions {
7878
/// * `ellipsis`: Ellipsis for indicating overflow.
7979
/// * `fmt_elem`: A function that formats an element in the list, given the
8080
/// formatter and the index of the item in the list.
81-
fn format_with_overflow<F>(
81+
fn format_with_overflow(
8282
f: &mut fmt::Formatter<'_>,
8383
length: usize,
8484
limit: usize,
8585
separator: &str,
8686
ellipsis: &str,
87-
mut fmt_elem: F,
87+
fmt_elem: &mut dyn FnMut(&mut fmt::Formatter, usize) -> fmt::Result
8888
) -> fmt::Result
89-
where
90-
F: FnMut(&mut fmt::Formatter<'_>, usize) -> fmt::Result,
9189
{
9290
if length == 0 {
9391
// no-op
@@ -146,7 +144,7 @@ where
146144
fmt_opt.collapse_limit(0),
147145
", ",
148146
ELLIPSIS,
149-
|f, index| format(&view[index], f),
147+
&mut |f, index| format(&view[index], f),
150148
)?;
151149
f.write_str("]")?;
152150
}
@@ -162,7 +160,7 @@ where
162160

163161
f.write_str("[")?;
164162
let limit = fmt_opt.collapse_limit(full_ndim - depth - 1);
165-
format_with_overflow(f, shape[0], limit, &separator, ELLIPSIS, |f, index| {
163+
format_with_overflow(f, shape[0], limit, &separator, ELLIPSIS, &mut |f, index| {
166164
format_array(
167165
&view.index_axis(Axis(0), index),
168166
f,

0 commit comments

Comments
 (0)