It was just a thought. The fact that Rust also has file level modules makes this somewhat unnecessary. Having said that, one extra level of indentation often bites you in the end (especially with a 80 character limit).
Also, I would like to add that in the middle of the file, you cannot find the difference between a module function or a function attached to the files main module
Also, this doesn’t really fit with Rust anyway, because each file is its own module. In C++, I’ve usually seen this style used when most of/the entire file is wrapped in a namespace, which Rust does automatically for you.
This C++ style only exists because of the extreme prevalence of a single namespace {} block covering the entire contents of the file. Normally, any nested namespace {} blocks do in fact get indented. Your first code example is something I’ve personally never seen in a C++ codebase.
And FWIW, even that really common style doesn’t play well with any sort of IDE that has auto-indentation. Even Xcode, which I have to assume is used a fair amount for C++, wants to indent the entire namespace.
Inline modules are not common enough in Rust (especially multiple levels of inline modules) to make it worth trying to reduce the indentation.
[quote=“As eridius, post:7, topic:94”]
Inline modules are not common enough in Rust (especially multiple levels of inline modules) to make it worth trying to reduce the indentation.
[/quote] … and when inline modules are used I think it’s important to make that visually stand out with the indentation.