-
Notifications
You must be signed in to change notification settings - Fork 969
Open
Labels
A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)I-poor-formattingIssue: poor formattingIssue: poor formattingP-lowLow priorityLow priority
Description
rustfmt is formatting - changing indentation - inside a macro, in what is not valid Rust code.
In the code below, if you change the indentation inside the proptest! macro, rustfmt will change it back to the way it is currently, when it should not. Repo with the repro.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Item {
pub first_long_name_a: u16,
pub item_count: u16,
pub area: u16,
pub address: u16,
}
#[cfg(test)]
mod tests {
use proptest::prelude::*;
use super::Item;
proptest! {
#[test]
fn read_item_chars(s in "\\PC*") {
let pi = Item{
first_long_name_a: 0,item_count: 0,area: 0,address: 0,};
}
}
}Tested on both 1.82 and nightly.
$ cargo fmt --version
rustfmt 1.7.1-stable (f6e511e 2024-10-15)
$ cargo +nightly fmt --version
rustfmt 1.8.0-nightly (33c245b9e9 2024-12-10)
Metadata
Metadata
Assignees
Labels
A-macrosArea: macros (procedural macros, macro_rules! macros, etc.)Area: macros (procedural macros, macro_rules! macros, etc.)I-poor-formattingIssue: poor formattingIssue: poor formattingP-lowLow priorityLow priority