Closed
Description
Running rust-script in any file that includes uppercase letter generates a crate with the same name, which cargo
complains.
While rust files are usually modules and as such should be lowercase, sometimes the user may choose a name that matches his project better. Also cargo-make uses temporary files that may contain uppercase letters.
My proposed solution would be to convert the file name to snake case when using as the crate name. serde
can do this for struct fields, so I suppose a simple solution already exists in the ecosystem. I can give it a try if you would accept.
Script.rs:
fn main() {
println!("test");
}
Output:
$ rust-script Script.rs
warning: crate `Script_5920885be5fa777047cfed70` should have a snake case name
|
= note: `#[warn(non_snake_case)]` on by default
= help: convert the identifier to snake case: `script_5920885be5fa777047cfed70`
warning: 1 warning emitted
test
Metadata
Metadata
Assignees
Labels
No labels