Proposal: new lint: aux.rs and other filenames

If someone develops on unixy computers, they could accidentally use one of the restricted Windows device filenames, making their project hard to compile/contribute to on Windows.

While this will become readily apparent as soon as, for example, the project adds CI to test on Windows, we could catch it early and less obscurely with a lightweight warn-by-default lint that recommends not using aux.rs, con.rs, or other such filenames in source.

This is related to but different from this earlier clippy lint for a warning with file paths such as File::open("aux").

This lint would not restrict mod names, only source filenames. For example, this would be lint-free:

mod aux {
    pub type Example = bool;
}
#[path="auxiliary.rs"]
mod aux;

but this would warn:

mod aux;
8 Likes

cargo has lints for this already when packaging. But yes, having it as a rustc lint as well seems like a good idea.

9 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.