Skip to content

rustfmt keeps indenting macros ofter each run #1917

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

Closed
Marwes opened this issue Aug 25, 2017 · 1 comment
Closed

rustfmt keeps indenting macros ofter each run #1917

Marwes opened this issue Aug 25, 2017 · 1 comment
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@Marwes
Copy link
Contributor

Marwes commented Aug 25, 2017

Original source

mod x {
    quickcheck! {
        fn test(a: String, s: String, b: String) -> TestResult {
            if a.find(&s).is_none() {

                TestResult::from_bool(true)
            } else {
                TestResult::discard()
            }
        }
    }
}

1 run

mod x {
    quickcheck! {
            fn test(a: String, s: String, b: String) -> TestResult {
                if a.find(&s).is_none() {
    
                    TestResult::from_bool(true)
                } else {
                    TestResult::discard()
                }
            }
        }
}

2 runs

mod x {
    quickcheck! {
                fn test(a: String, s: String, b: String) -> TestResult {
                    if a.find(&s).is_none() {
    
                        TestResult::from_bool(true)
                    } else {
                        TestResult::discard()
                    }
                }
            }
}

Version

0.2.2-nightly ( )

Minimizing further seems to make rustfmt leave the macro alone.

#1907 might be the cause?

@topecongiro topecongiro added the bug Panic, non-idempotency, invalid code, etc. label Aug 25, 2017
@topecongiro
Copy link
Contributor

This is definitely introduced by #1907. Looks like we get this behavior when we have an empty line inside block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

2 participants