Hacker News new | ask | show | jobs
by criddell 3409 days ago
I looked at the Rust documentation's getting started page and it says:

> If you’re using more than one word in your filename, use an underscore: hello_world.rs rather than helloworld.rs.

Is the use of underscores a recommendation or a limitation?

3 comments

Of course it's just a recommendation. Why would you think otherwise? To Rust, module name is just a bunch of characters, it doesn't recognize words anyhow.
It's a recommendation that you'll find everywhere in rust. By default camelCasing will output compiler warnings. It's my only complaint about the language so far, underscores aren't very typing friendly.
It's kinda both. Since module names are identifiers, you can't use -s in them. You can still make it work, I believe, with the path attribute, but you'd need to do it on every mod declaration.