-
Notifications
You must be signed in to change notification settings - Fork 974
Open
Labels
A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-poor-formattingIssue: poor formattingIssue: poor formatting
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.
Metadata
Metadata
Assignees
Labels
A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-poor-formattingIssue: poor formattingIssue: poor formatting