When does "cargo fmt" move "use" entries to the top of the file?

My source code files usually begin with a big comment before any code.
Every once in a while, "cargo fmt" moves some "use" lines above the comment at the top of the file. Why? And how does it decide which ones to move? It seems random.

It will sort your use statements, however it will not mix import groups with an empty line between them.

1 Like

Ah. That's useful information. It's not particularly useful behavior, but at least it's not random.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.