Open
Description
rustfmt requires multiple runs to generate consistent output for this input code:
fn zserio_read(&mut self, reader: &mut BitReader) -> Result<()> {
self.headers = vec![crate::reference_modules::parameter_passing::index_operator::block_header::BlockHeader::new(); headers_array_length];
self.blocks = vec![crate::reference_modules::parameter_passing::index_operator::block::Block::new(); blocks_array_length];
}
After a first pass the code is updated to this:
fn zserio_read(&mut self, reader: &mut BitReader) -> Result<()> {
self.headers = vec![crate::reference_modules::parameter_passing::index_operator::block_header::BlockHeader::new(); headers_array_length];
self.blocks =
vec![
crate::reference_modules::parameter_passing::index_operator::block::Block::new();
blocks_array_length
];
}
And after a second pass it moves the vec!
invocation to the line with the assignment:
fn zserio_read(&mut self, reader: &mut BitReader) -> Result<()> {
self.headers = vec![crate::reference_modules::parameter_passing::index_operator::block_header::BlockHeader::new(); headers_array_length];
self.blocks = vec![
crate::reference_modules::parameter_passing::index_operator::block::Block::new();
blocks_array_length
];
}
after this rustfmt is happy an running it again creates no further changes.