erikgrinaker / toydb

Distributed SQL database in Rust, written as a learning project
Apache License 2.0
5.99k stars 555 forks source link

fix for no more mod.rs and a compile warning #43

Closed pkking closed 3 years ago

pkking commented 3 years ago

As of rust 2018, it's not recomanded to write mod.rs file in each module, so i convert these mod.rs to the newer style.

And also when i build this repo with toolchain(rustc 1.52.0-nightly (d1206f950 2021-02-15)), there is a compile warning says: warning: unnecessary trailing semicolon, fix it too.

erikgrinaker commented 3 years ago

Thanks @pkking! I did consider this approach, but I really prefer to keep a module in a single directory since it's easier to navigate that way -- especially since the module files themselves can contain significant amounts of code (Clippy complains if I put e.g. the parser in parser/parser.rs, which I personally think would be cleaner than parser/mod.rs).

pkking commented 3 years ago

I agree with that a module should be organized in a single directory, but this rule is try to make things cleaner like a directory contain both the module code itself and the submodule of it. Such as src/sql/execution contains a mod.rs which hold the Executor logic code, also the submodules of execution(which are aggregation, join, etc.) lives in the same directory, at least from the filesystem hierarchy it not so clear shows they are child modules of execution.

I think toydb is still a small and personal project, this isn't a problem, feel free to repoen this issue when these mod.rss really hurt :)