-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustfmt doesn't format proptest! blocks #2867
Comments
Currently rustfmt does not format a macro call with braces. Could you please try using parentheses instead by replacing |
@topecongiro That doesn't seem to have any effect. I'm using stable: |
Hi there, Apologies for the bump, I just wanted to check if the issue I'm seeing is the same as this one, before submitting an issue. Example repository: https://github.com/joshuataylor/proptest_example Ideally, I would like the code to look like this: https://github.com/joshuataylor/proptest_example/blob/main/tests/proptest_test.rs #[cfg(test)]
mod tests {
use proptest::prelude::*;
proptest!(
#![proptest_config(ProptestConfig::with_cases(2))]
#[test]
fn test_example(a in 1..4i32, b in 5..10i32) {
prop_assert!(a <= b);
}
);
proptest! {
#![proptest_config(ProptestConfig::with_cases(2))]
#[test]
fn test_example2(a in 1..4i32, b in 5..10i32) {
prop_assert!(a <= b);
}
}
} Here is a sample file, with no formatting. #[cfg(test)]
mod tests {
use proptest::prelude::*;
proptest!(
#![proptest_config(ProptestConfig::with_cases(2))]
#[test]
fn test_example(a in 1..4i32, b in 5..10i32) {
prop_assert!(a <= b);
}
);
proptest! {
#![proptest_config(ProptestConfig::with_cases(2))]
#[test]
fn test_example2(a in 1..4i32, b in 5..10i32) {
prop_assert!(a <= b);
}
}
}
#[cfg(test)]
mod tests {
use proptest::prelude::*;
proptest!(
#![proptest_config(ProptestConfig::with_cases(2))]
#[test]
fn test_example(a in 1..4i32, b in 5..10i32) {
prop_assert!(a <= b);
}
);
proptest! {
#![proptest_config(ProptestConfig::with_cases(2))]
#[test]
fn test_example2(a in 1..4i32, b in 5..10i32) {
prop_assert!(a <= b);
}
}
} Tested on:
|
I tried searching around but couldn't find anything about this. I'm trying to use rustfmt (by way of cargo fmt) to format my files, but the
proptest!
blocks are not being formatted. Seems like a valuable thing to support. Am I missing something?The text was updated successfully, but these errors were encountered: