Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source code indentation - 4 spaces #5931

Closed
pbc opened this issue Apr 18, 2013 · 1 comment
Closed

source code indentation - 4 spaces #5931

pbc opened this issue Apr 18, 2013 · 1 comment

Comments

@pbc
Copy link

pbc commented Apr 18, 2013

According to this document :

https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style

You suggest 2 space indentations in your code, but in Rust's code you use 4 space indentation everywhere.

Is this something that could be changed or is this another exception in your coding style?

@thestinger
Copy link
Contributor

Rust uses Python's PEP8 guidelines (4-space indentation, function_name, method_name, TypeName, CONSTANT, etc.) with the line limit at 100 columns instead of 78. I don't think those Mozilla coding guidelines aren't applied at all, except for the common universal ones like using Unix newlines, ending with a newline and restricting scope when possible.

flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 10, 2020
improve the suggestion of the lint `unit-arg`

Fixes rust-lang#5823
Fixes rust-lang#6015

Changes
```
help: move the expression in front of the call...
  |
3 |     g();
  |
help: ...and use a unit literal instead
  |
3 |     o.map_or((), |i| f(i))
  |
```
into
```
help: move the expression in front of the call and replace it with the unit literal `()`
  |
3 |     g();
  |     o.map_or((), |i| f(i))
  |
```
changelog: improve the suggestion of the lint `unit-arg`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants