Rust-guidelines specifies whitespace


#41

Width restriction doesn’t make sense anyway other than “don’t make your lines too long”. I use a proportional font so how do I even follow that one?

Just look in the corner every time to make sure my line is not over X? Because putting a red line on the side won’t work in proportional fonts.


#42

Sorry, this is not so. It serves many purposes:

  1. Makes it more convenient to see side-by-side diffs and use 3-way merge
  2. Helps to read the source w/o enlarging the window - such as in terminal besides your main window
  3. Helps to control complexity - overflowing width limit means you either are too deeply nested or use too long names.

Most people use monospaced fonts for programming. What’s the purpose of using a proportional one for this task?


#43

Because you can read proportional fonts faster than monospaced fonts. The difference in character widths allows you to see words by their shapes more readily.

See:

http://input.fontbureau.com/info/


#44

I know that this is a VERY old thread (3-ish years) but I wanted to add a very simple thought. Create two documents:

Rust-API-Guidelines Rust-Formatting/Style/Language-Guidelines

This would separate the API stuff from the “how the heck do I write Rust code” stuff :slight_smile:


#45

Yes, it’s an old thread, but the discussion is an important one. I’m dismayed to see a language with such promise implementing a language-level standard on something so indelibly subjective as whitespace. I come from a C++ background, and one of its perks is that it doesn’t waste time on establishing such drivel. The term “bikeshedding” was employed above, and I can’t fathom more fitting circumstances for its use.

It’s my project. It’s my code. I will set the coding style as I deem appropriate. End of story.


#46

Bully for you. Nothing in this thread or that rustfmt is doing prevents you from doing so.


#47

Nothing in this thread or that rustfmt is doing prevents you from doing so.

And I’m quite happy about that, but it’s tangential to the topic at hand.


#48

Alright, alright, now everybody please hold on just a moment here!

The document that this topic has largely been about is a bit old, and—as people have brought up, it is not entirely about API guidelines… but there is a new document in the works, which the rust-libs team has been building with wisdom gained through the Rust Libz Blitz:

These are the new rust API guidelines!

Notice that there is nothing about spaces, indentation, brace style. Hell, it doesn’t even tell you that you should run rustfmt! Just public API.

…so can we all please calm down now? :slight_smile: