Thread (108 messages) 108 messages, 11 authors, 2023-11-22

Re: [PATCH net-next v7 0/5] Rust abstractions for network PHY drivers

From: Miguel Ojeda <hidden>
Date: 2023-10-28 11:07:57
Also in: rust-for-linux

On Sat, Oct 28, 2023 at 12:55 AM Andrew Lunn [off-list ref] wrote:
You will probably find different levels of acceptance of 80 to 100 in
different subsystems. So i'm not sure you will be able to achieve
consistence.
I would definitely agree if this were C. I happen to maintain
`.clang-format`, and it was an interesting process to approximate a
"common enough" style as the base one.

But for Rust, it is easy, because all the code is new. All Rust files
are formatted the same way, across the entire kernel.
It should also be noted that 80, or 100, is not a strict limit. Being
able to grep the kernel for strings is important. So the coding
standard allows you to go passed this limit in order that you don't
need to break a string. checkpatch understands this. I don't know if
your automated tools support such exceptions.
Not breaking string literals is the default behavior of `rustfmt` (and
we use its default behavior).

It is also definitely possible to turn off `rustfmt` locally, i.e. for
particular "items" (e.g. a function, a block, a statement), rather
than lines, which is very convenient.

However, as far as I recall, we have never needed to disable it. I am
sure it will eventually be needed somewhere, but what I am trying to
say is that it works well enough that one can just use it.

Cheers,
Miguel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help