Skip to content
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 takes 32 seconds for this 1140 character file #4867

Open
Volker-Weissmann opened this issue Jun 13, 2021 · 1 comment · Fixed by #5139
Open

rustfmt takes 32 seconds for this 1140 character file #4867

Volker-Weissmann opened this issue Jun 13, 2021 · 1 comment · Fixed by #5139
Labels

Comments

@Volker-Weissmann
Copy link

Volker-Weissmann commented Jun 13, 2021

Formatting the code below takes 32 seconds on my machine.
This is not bad performance, this is a bug (If I remove one mod layer it takes 0.2 seconds).

In my real world, program (that uses pest), running cargo expand is therefore nearly impossible (I stopped it after an hour)

mod modA {
    mod modB {
        mod modC {
            mod modD {
                mod modE {
                    fn func() {
                        state . rule (Rule :: myrule , | state | { state . sequence (| state | { state . sequence (| state | { state . match_string ("abc") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . match_string ("def") }) }) . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . sequence (| state | { state . optional (| state | { state . sequence (| state | { state . match_string ("abc") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . match_string ("def") }) }) . and_then (| state | { state . repeat (| state | { state . sequence (| state | { super :: hidden :: skip (state) . and_then (| state | { state . sequence (| state | { state . match_string ("abc") . and_then (| state | { super :: hidden :: skip (state) }) . and_then (| state | { state . match_string ("def") }) }) }) }) }) }) }) }) }) }) });
                    }
                }
            }
        }
    }
}
@Volker-Weissmann Volker-Weissmann changed the title rustfmt takes 32 seconds for this 1140 character File rustfmt takes 32 seconds for this 1140 character file Jun 13, 2021
@ytmimi
Copy link
Contributor

ytmimi commented Jun 23, 2022

Reopen since we had to revert #5139 in #5403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants