Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.
This repository was archived by the owner on Oct 9, 2018. It is now read-only.

Clarify where imports should be placed #27

Open
@ftxqxd

Description

@ftxqxd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions