Skip to content

Commit f188f1d

Browse files
committed
use [&mut dyn] for rules
1 parent baf8fa6 commit f188f1d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/formatting/cargo_toml.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ use crate::{Config, ErrorKind};
88

99
pub(crate) fn format_cargo_toml_inner(content: &str, config: &Config) -> Result<String, ErrorKind> {
1010
let mut doc = content.parse::<toml_edit::Document>()?;
11-
let rules: Vec<Box<dyn VisitMut>> = vec![
12-
Box::new(SortSection {
11+
let rules = [
12+
&mut SortSection {
1313
current_position: 0,
14-
}),
15-
Box::new(SortKey),
16-
Box::new(BlankLine { trimming: true }),
17-
Box::new(KeyValue),
18-
Box::new(MultiLine),
19-
Box::new(WrapArray {
14+
} as &mut dyn VisitMut,
15+
&mut SortKey,
16+
&mut BlankLine { trimming: true },
17+
&mut KeyValue,
18+
&mut MultiLine,
19+
&mut WrapArray {
2020
max_width: config.max_width(),
21-
}),
22-
Box::new(FormatInlineTable {
21+
},
22+
&mut FormatInlineTable {
2323
max_width: config.max_width(),
2424
long_tables: vec![],
2525
current_section: String::new(),
26-
}),
26+
},
2727
];
2828
for mut rule in rules.into_iter() {
2929
rule.visit_document_mut(&mut doc);

0 commit comments

Comments
 (0)