Currently Intellij rust can only recognize and run main function in main.rs file in UI (eg menu, context menu), and not other rust file with main function. It should be able to run any rust file with main function just as rustc can do likewise
Eg, the following should have Run in its context menu.

@macdevign we run rust code via Cargo, so Cargo must recognize this file as a binary. For example, you can place your file inside src/bin subdirectory, or you could add [[bin]] section to the Cargo.toml (the first option is preferable).
I would love to see a right-click and compile/run on any file with a main fn. Seems like a key feature when hacking around in different files and testing things.
We follow cargo project structure and run binary via cargo. So we can't implement it for now.
Most helpful comment
I would love to see a right-click and compile/run on any file with a main fn. Seems like a key feature when hacking around in different files and testing things.