Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.

I am in love with this awsome document; I love its guidelines, and coding conventions.

However, when Rust was introduced into the kernel, they butchered these beautiful guidelines, I know it’s hard to look at such heretic actions, but you have to see this:

The default settings of rustfmt are used. This means the idiomatic Rust style is followed. For instance, 4 spaces are used for indentation rather than tabs.

How can this even relate to the ideology of the first document? I am deeply saddened by these new rules.

I know this is “The Rust experiment”, but this must be fixed before it’s too late! This has to reach someone.

A counter-argument might be:

The code should be formatted using rustfmt. In this way, a person contributing from time to time to the kernel does not need to learn and remember one more style guide. More importantly, reviewers and maintainers do not need to spend time pointing out style issues anymore, and thus less patch roundtrips may be needed to land a change.

And to that I say that rustfmt is configurable per project, and if it isn’t, then it has to be. Doesn’t something like .editorconfig exist?

  • Doods@infosec.pubOP
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    8 months ago

    My emotions just stopped, so I can now think straight.

    There are really only 2 changes that - in my eyes - should be made:

    • 8 space-long, hard tabs.
    • 80 character limit instead of 100.

    I don’t think a tool like rustfmt can affect most of the original guidelines, and it’s generally compatible with the OG style by default.

    Edit: I - surprisingly - never actually used rustfmt, so I will go now and test before I say something stupid

    • acockworkorange@mander.xyz
      link
      fedilink
      arrow-up
      0
      ·
      8 months ago

      We are not stuck to DEC VT100 terminals anymore. It’s okay to have 100 columns of code. And wasting 10% of that space for each indentation? What are you smoking?

      • Doods@infosec.pubOP
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        8 months ago

        wasting 10% of that space for each indentation? What are you smoking?

        As I said before, this standard is older than C itself, and the kernel’s been using it for decades, I shouldn’t have to explain it. Long tabs and short lines boost readability, and restricting indentation to 3 solves the problem. Read my reply to 1rre@discuss.tchncs.de for more context.

        Also rustfmt didn’t move the string in

        println!("a very long string slice with a static lifetime"); to a new line even when it exceeded a 100 columns, I should seek a solution.

        Note: The actual string I used was way longer than that.

    • thingsiplay@beehaw.org
      link
      fedilink
      arrow-up
      0
      ·
      8 months ago

      8 space-long, hard tabs.

      Hard disagree. 8 spaces is waste and 4 should be industry standard. Tabs should not be used for indentation, but spaces. On the other side, Tabs are configurable, so that’s actually a plus point.

      80 character limit instead of 100.

      Why? 80 is an old standard with limitations that do not apply today anymore. We have wider screens and higher resolutions. While it makes sense to keep this to be consistent with previous code and language defaults for C, there is no reason to enforce this for the new adopted language, which already has a standard on its own.

      And yes rustfmt can be configured and when I started with Rust I changed max_width to 80, just because I was used to it with Python. But there is no benefit doing this in Rust.