You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 9, 2018. It is now read-only.
In most code, use imports are placed directly at the top of the file/module. However, sometimes I see them situated within a function. The Rust guidelines would be a great place to clarify where use imports should be placed. My recommendation would be to put all imports at the top of the module, except maybe for tests, where any imports specific to that function should be placed within that function only. (For example, if only one test uses std::collections::HashMap, the use statement should be placed within that function only.) Oh, and maybe main should also have any specific imports at the top of the function rather than the module.
The text was updated successfully, but these errors were encountered:
In most code,
use
imports are placed directly at the top of the file/module. However, sometimes I see them situated within a function. The Rust guidelines would be a great place to clarify whereuse
imports should be placed. My recommendation would be to put all imports at the top of the module, except maybe for tests, where any imports specific to that function should be placed within that function only. (For example, if only one test usesstd::collections::HashMap
, theuse
statement should be placed within that function only.) Oh, and maybemain
should also have any specific imports at the top of the function rather than the module.The text was updated successfully, but these errors were encountered: