Rust support
Subsystems (16)
Hey Miguel and others,
Having followed this for a while, I finally decided it best to at least share some thoughts in the hopes to make life better for us with some readability/accessibility issues, such as dyslexia for example.
I apologize for being late to the party and for potentially using the wrong thread, but I recall somewhere in v5 that it was best to respond to the RFC for general comments.
Quoted 11 lines · On 14-04-2021 20:45, [email protected] wrote:
From: Miguel Ojeda <[email protected]>
Some of you have noticed the past few weeks and months that a serious attempt to bring a second language to the kernel was being forged. We are finally here, with an RFC that adds support for Rust to the Linux kernel.
This cover letter is fairly long, since there are quite a few topics to describe, but I hope it answers as many questions as possible before the discussion starts.
<snip>
Quoted 8 lines
Moreover, as explained above, we are taking the chance to enforce some documentation guidelines. We are also enforcing automatic code formatting, a set of Clippy lints, etc. We decided to go with Rust's idiomatic style, i.e. keeping
rustfmtdefaults. For instance, this means 4 spaces are used for indentation, rather than a tab. We are happy to change that if needed -- we think what is important is keeping the formatting automated
Enforcing this is great, but how will you enforce this 'everywhere'? Right now, you can easily 'bypass' any CI put in place, and while 'for now' this is only about the Rust infra, where this can be strongly enforced, once we see actual drivers pop-up; these won't go through the Rust CI before merging CI forever? A maintainer can 'just merge' something still, right?
Anyway, what I wanted to criticize, is the so called "keeping with rustfmt defaults". It has been known, that, well Rust's defaults are pretty biased and opinionated. For the Rust project, that's fair of course, their code, their rules.
However, there's two arguments against that. For one, using the Rust 'style', now means there's 2 different code styles in the Kernel. Cognitively alone, that can be quite frustrating and annoying. Having to go back and forth between two styles can be mentally challenging which only causes mistakes and frustration. So why change something that already exists? Also, see my first point. Having to constantly remember/switch to 'in this file/function the curly brace is on a different line'. Lets try to stay consistent, the rules may not be perfect (80 columns ;), but so far consistency is tried. OCD and Autism etc doesn't help with this ;)
Secondly, and this is really far more important, the Rust default style is not very inclusive, as it makes readability harder. This has been brought up by many others in plenty of places, including the rustfmt issue tracker under bug #4067 [0]. While the discussion eventually only led to the 'fmt-rfcs' [1], where it was basically said 'you could be on to something, but this ship has sailed 3 years ago (when nobody was looking caring), and while we hear you, we're not going to change our defaults anymore.
But I also agree and share these commenters pain. When the tab character is used for indenting (and not alignment mind you), then visually impaired (who can still be amazing coders) can more easily read code by adjusting the width what works best to them.
With even git renaming master to main to be more inclusive, can we also be more inclusive to us that have a hard time distinguishing narrow indentations?
Thanks, and sorry for rubbing any ones nerves, but to "some of us" this actually matters a great deal.
Olliver
P.S. would we expect inline C/Rust code mixed? What then?
<snip>
[0]: https://github.com/rust-lang/rustfmt/issues/4067#issuecomment-685961408
[1]: https://github.com/rust-dev-tools/fmt-rfcs/issues/1#issuecomment-911804826
Hi Olliver,
Quoted 4 lines · Olliver Schinagl
I apologize for being late to the party and for potentially using the wrong thread, but I recall somewhere in v5 that it was best to respond to the RFC for general comments.
No need to apologize! Feel free to use the latest threads or a new thread in e.g. the rust-for-linux ML.
Quoted 11 lines · On 14-04-2021 20:45, [email protected] wrote:
Quoted 9 lines
From: Miguel Ojeda <[email protected]>
Moreover, as explained above, we are taking the chance to enforce some documentation guidelines. We are also enforcing automatic code formatting, a set of Clippy lints, etc. We decided to go with Rust's idiomatic style, i.e. keeping
rustfmtdefaults. For instance, this means 4 spaces are used for indentation, rather than a tab. We are happy to change that if needed -- we think what is important is keeping the formatting automated
Quoted 6 lines
Enforcing this is great, but how will you enforce this 'everywhere'? Right now, you can easily 'bypass' any CI put in place, and while 'for now' this is only about the Rust infra, where this can be strongly enforced, once we see actual drivers pop-up; these won't go through the Rust CI before merging CI forever? A maintainer can 'just merge' something still, right?
Indeed, but there are workarounds, for instance, we could have a bot checking -next.
Or we could put it in an opt-in compilation mode (i.e. not for users) where extra things are checked (like W=) that maintainers use so that e.g. allmodconfig builds are kept clean.
Quoted 5 lines
Anyway, what I wanted to criticize, is the so called "keeping with
rustfmtdefaults". It has been known, that, well Rust's defaults are pretty biased and opinionated. For the Rust project, that's fair of course, their code, their rules.
Quoted 10 lines
However, there's two arguments against that. For one, using the Rust 'style', now means there's 2 different code styles in the Kernel. Cognitively alone, that can be quite frustrating and annoying. Having to go back and forth between two styles can be mentally challenging which only causes mistakes and frustration. So why change something that already exists? Also, see my first point. Having to constantly remember/switch to 'in this file/function the curly brace is on a different line'. Lets try to stay consistent, the rules may not be perfect (80 columns ;), but so far consistency is tried. OCD and Autism etc doesn't help with this ;)
Note that the point of using rustfmt is that one does not need to care about the details -- one can e.g. run the tool on file save. So no need to remember how to do it when writing Rust.
Now, it is true that the Rust syntax resembles C in many cases, so things like the curly braces for function definitions are similar enough that we could do the same thing in both sides.
However, most Rust code uses rustfmt and typically also follow most of its defaults, including the standard library, books, etc.; which helps when reading and reusing other code. This is different from C and C++, where as you know there is no single style (at least as prevalent as rustfmt), thus one needs to become accustomed to each project's C style (or ideally use clang-format to avoid having to learn it). So while this is not relevant for C, in the case of Rust, there is value in using the rustfmt style.
As for consistency, one could argue that by using rustfmt we are being consistent with the rest of the Rust code out there. This may be important for those that have expressed interest on sharing some code between kernel and userspace; as well as if we end up vendoring some external crates (similar to what we do with alloc now).
Quoted 9 lines
Secondly, and this is really far more important, the Rust default style is not very inclusive, as it makes readability harder. This has been brought up by many others in plenty of places, including the
rustfmtissue tracker under bug #4067 [0]. While the discussion eventually only led to the 'fmt-rfcs' [1], where it was basically said 'you could be on to something, but this ship has sailed 3 years ago (when nobody was looking caring), and while we hear you, we're not going to change our defaults anymore.
Quoted 8 lines
But I also agree and share these commenters pain. When the tab character is used for indenting (and not alignment mind you), then visually impaired (who can still be amazing coders) can more easily read code by adjusting the width what works best to them.
With even git renaming
mastertomainto be more inclusive, can we also be more inclusive to us that have a hard time distinguishing narrow indentations?
As noted in the RFC, we are happy to tweak the style to whatever kernel developers prefer. We think the particular style is not that important. Absent other reasons, the defaults seem OK, so we chose that for simplicity and consistency with as most existing Rust code as possible.
As for accessibility, I am no expert, so that may be a good point, especially if editors cannot solve this on their end (so that everyone could program in all languages/projects regardless of style).
Quoted 2 lines
Thanks, and sorry for rubbing any ones nerves, but to "some of us" this actually matters a great deal.
No nerves were damaged :) Thanks for all the input!
Quoted 1 line
P.S. would we expect inline C/Rust code mixed? What then?
Everything is possible, e.g. we could have Rust proc macros that parse C and things like that. But if we ended up with such a thing, the solution would be to format each accordingly to its style (indentation could be an exception, I guess).
Cheers,
Miguel
Hey Miguel,
Sorry for the late reply ;)
Quoted 29 lines · Miguel Ojeda
Hi Olliver,
Quoted 4 lines · Olliver Schinagl
I apologize for being late to the party and for potentially using the wrong thread, but I recall somewhere in v5 that it was best to respond to the RFC for general comments.
No need to apologize! Feel free to use the latest threads or a new thread in e.g. the rust-for-linux ML.
Quoted 11 lines · On 14-04-2021 20:45, [email protected] wrote:
Quoted 9 lines
From: Miguel Ojeda <[email protected]>
Moreover, as explained above, we are taking the chance to enforce some documentation guidelines. We are also enforcing automatic code formatting, a set of Clippy lints, etc. We decided to go with Rust's idiomatic style, i.e. keeping
rustfmtdefaults. For instance, this means 4 spaces are used for indentation, rather than a tab. We are happy to change that if needed -- we think what is important is keeping the formatting automatedQuoted 6 lines
Enforcing this is great, but how will you enforce this 'everywhere'? Right now, you can easily 'bypass' any CI put in place, and while 'for now' this is only about the Rust infra, where this can be strongly enforced, once we see actual drivers pop-up; these won't go through the Rust CI before merging CI forever? A maintainer can 'just merge' something still, right?
Quoted 2 lines
Indeed, but there are workarounds, for instance, we could have a bot checking -next.
Absolutly, but with the many luitenants, many tree's, and not a single CI source, this would still be tricky in the end; but certainly possible.
Quoted 21 lines
Or we could put it in an opt-in compilation mode (i.e. not for users) where extra things are checked (like
W=) that maintainers use so that e.g.allmodconfigbuilds are kept clean.Quoted 5 lines
Anyway, what I wanted to criticize, is the so called "keeping with
rustfmtdefaults". It has been known, that, well Rust's defaults are pretty biased and opinionated. For the Rust project, that's fair of course, their code, their rules.Quoted 10 lines
However, there's two arguments against that. For one, using the Rust 'style', now means there's 2 different code styles in the Kernel. Cognitively alone, that can be quite frustrating and annoying. Having to go back and forth between two styles can be mentally challenging which only causes mistakes and frustration. So why change something that already exists? Also, see my first point. Having to constantly remember/switch to 'in this file/function the curly brace is on a different line'. Lets try to stay consistent, the rules may not be perfect (80 columns ;), but so far consistency is tried. OCD and Autism etc doesn't help with this ;)
Quoted 3 lines
Note that the point of using
rustfmtis that one does not need to care about the details -- one can e.g. run the tool on file save. So no need to remember how to do it when writing Rust.
And that's great of course, I was mearly speaking of the configuration of rustfmt. I think as a tool it's pretty great!
Quoted 5 lines
Now, it is true that the Rust syntax resembles C in many cases, so things like the curly braces for function definitions are similar enough that we could do the same thing in both sides.
Quoted 8 lines
However, most Rust code uses
rustfmtand typically also follow most of its defaults, including the standard library, books, etc.; which helps when reading and reusing other code. This is different from C and C++, where as you know there is no single style (at least as prevalent asrustfmt), thus one needs to become accustomed to each project's C style (or ideally useclang-formatto avoid having to learn it). So while this is not relevant for C, in the case of Rust, there is value in using therustfmtstyle.
I think this is a pretty poor argument for following Rust's opinionated view of the world. E.g. it's generally bad to copy/paste code to begin with. How many 'bugs' that we know of are copy/paste bugs?
Secondly, and more importantly so; you argue 'who cares about people with disablements, atleast its equally hard to read everywhere' which is a very poor argument :p
Finally, it must of course be mentioned, that rust is really trying to do an XKCD here, https://xkcd.com/927/ though I'm sure we'll get it right this time around ;)
Quoted 3 lines
As for consistency, one could argue that by using
rustfmtwe are being consistent with the rest of the Rust code out there.
But you are not, only those that follow rust's biased view. Everybody else that has a different opinion (like die-hard C programmers) that care enough (I'm sure there's plenty) would setup their rustfmt config file to resemble their C code; and thus the entire premisis is broken. Though; yes, in a perfect world it could have worked like this, but xkcd again :)
Quoted 4 lines
This may be
important for those that have expressed interest on sharing some code between kernel and userspace; as well as if we end up vendoring some external crates (similar to what we do withallocnow).
This though is a fair argument I understand, it would be weird in having 2 styles in user-space and kernel-space code; though I see this happening today as well; where developers follow kernel style for kernel code (obviously) but use their preferred 2 or 3 space style on their userland code. Trying to 'force' this, usually however never gets the intended result ...
Quoted 25 lines
Quoted 10 lines
Secondly, and this is really far more important, the Rust default style is not very inclusive, as it makes readability harder. This has been brought up by many others in plenty of places, including the
rustfmtissue tracker under bug #4067 [0]. While the discussion eventually only led to the 'fmt-rfcs' [1], where it was basically said 'you could be on to something, but this ship has sailed 3 years ago (when nobody was looking caring), and while we hear you, we're not going to change our defaults anymore.Quoted 8 lines
But I also agree and share these commenters pain. When the tab character is used for indenting (and not alignment mind you), then visually impaired (who can still be amazing coders) can more easily read code by adjusting the width what works best to them.
With even git renaming
mastertomainto be more inclusive, can we also be more inclusive to us that have a hard time distinguishing narrow indentations?As noted in the RFC, we are happy to tweak the style to whatever kernel developers prefer. We think the particular style is not that important. Absent other reasons, the defaults seem OK, so we chose that for simplicity and consistency with as most existing Rust code as possible.
Quoted 3 lines
As for accessibility, I am no expert, so that may be a good point, especially if editors cannot solve this on their end (so that everyone could program in all languages/projects regardless of style).
Yeah, this is a common reasoning. People without disabilities often oversee cases to those with. E.g. Traffic lights being red and green is horrible for colorblind people; luckily enough we have 'order' to help distinguish there for example. While I'm not colorblind myself, I often have to remind UX designers, with their fancy LED based UI's, to think of others as well, which always strikes them as odd first, then of course they only start to realize this.
I'm with you that style is the least important for the functionality, no argument there. Long-term though; this will matter of course, to those like me, have hard times here.
Quoted 4 lines
Quoted 3 lines
Thanks, and sorry for rubbing any ones nerves, but to "some of us" this actually matters a great deal.
Quoted 8 lines
No nerves were damaged :) Thanks for all the input!
Quoted 1 line
P.S. would we expect inline C/Rust code mixed? What then?Everything is possible, e.g. we could have Rust proc macros that parse C and things like that. But if we ended up with such a thing, the solution would be to format each accordingly to its style (indentation could be an exception, I guess).
The first exception to the rule starts here already :p
Thanks for your thoughts,
Olliver
Quoted 3 lines
Cheers,
Miguel
Quoted 3 lines · Olliver Schinagl
Absolutly, but with the many luitenants, many tree's, and not a single CI source, this would still be tricky in the end; but certainly possible.
A bot in -next (possibly an existing one) is a single thing to care about and the amount of maintainers/trees doesn't have an effect on it, thus I don't think it would be tricky.
Quoted 3 lines
I think this is a pretty poor argument for following Rust's opinionated view of the world. E.g. it's generally bad to copy/paste code to begin with. How many 'bugs' that we know of are copy/paste bugs?
We will have to disagree. Consistency and simplicity are fine arguments in my book, not "pretty poor" ones.
I don't see the relevance of the copy/paste code discussion here. But assuming the analogy makes sense, I don't agree that reusing code is "generally bad" either.
Anyway, given you mention "bugs", I think you are implying that the defaults are somehow "incorrect" (not accessible?). In that case, to improve things for all Rust developers out there, I would suggest opening an issue in https://github.com/rust-dev-tools/fmt-rfcs.
Quoted 3 lines
Secondly, and more importantly so; you argue 'who cares about people with disablements, atleast its equally hard to read everywhere' which is a very poor argument :p
No, and I want to be __very__ clear about this: at no point I have argued "who cares about people with disabilities" or anything like it. It is insulting that you even suggest it.
Likewise, you are the one claiming it is "hard to read", not me.
And then after constructing those straw men, you call them "a very poor argument"...
Quoted 3 lines
Finally, it must of course be mentioned, that rust is really trying to do an XKCD here, https://xkcd.com/927/ though I'm sure we'll get it right this time around ;)
How does that even apply here? There is no "standard" for formatting across languages, if that is what you are saying.
Actually, what is happening here is that there is an "official" tool, called rustfmt, that most Rust code out there uses.
By not using it, it is you the one that may be creating a XKCD situation, if anything.
And to be clear, we don't necessarily follow "Rust's biased view". For instance, there is also an "official" build tool, called Cargo, that most Rust code out there uses; yet we are not using it for the kernel.
We are actually doing things how we think are best for the kernel. Not because "Rust" (whatever or whoever that is) is "trying to do an XKCD". Not because we are "following Rust's opinionated view of the world" or "Rust's biased view".
Quoted 6 lines
But you are not, only those that follow rust's biased view. Everybody else that has a different opinion (like die-hard C programmers) that care enough (I'm sure there's plenty) would setup their rustfmt config file to resemble their C code; and thus the entire premisis is broken. Though; yes, in a perfect world it could have worked like this, but xkcd again :)
No. I said we are being consistent with the majority of the Rust code out there, not with "everybody".
If, instead, we try to be consistent with the kernel C style, then you are likely not being consistent with the majority of the Rust code out there. And you would have to decide exactly how to map the C style to Rust constructs and which particular kernel style.
Again: I personally don't mind what the particular style is. As a project, what we value the most is having a single style across it and not having to think about formatting. Nevertheless, I think there is also value in being consistent with the majority of the Rust code out there.
Quoted 6 lines
This though is a fair argument I understand, it would be weird in having 2 styles in user-space and kernel-space code; though I see this happening today as well; where developers follow kernel style for kernel code (obviously) but use their preferred 2 or 3 space style on their userland code. Trying to 'force' this, usually however never gets the intended result ...
If we follow the usual Rust style in the kernel, I would say it is more likely that both styles match.
Cheers,
Miguel
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · Olliver Schinagl
Secondly, and more importantly so; you argue 'who cares about people with disablements, atleast its equally hard to read everywhere' which is a very poor argument :p
No, and I want to be
__very__clear about this: at no point I have argued "who cares about people with disabilities" or anything like it. It is insulting that you even suggest it.
What "people with disablements" have to do with this anyway? I don't get it.
Nicolas
Hey Nicolas,
Quoted 9 lines · Nicolas Pitre
Quoted 7 lines · Miguel Ojeda
Quoted 3 lines · Olliver Schinagl
Secondly, and more importantly so; you argue 'who cares about people with disablements, atleast its equally hard to read everywhere' which is a very poor argument :p
Quoted 6 lines
Quoted 3 lines
No, and I want to be
__very__clear about this: at no point I have argued "who cares about people with disabilities" or anything like it. It is insulting that you even suggest it.What "people with disablements" have to do with this anyway? I don't get it.
If you are talking to me; simple, reading disabilities (dyslexia being the most common one) are real :) and code-style heavily impacts those.
For example, I have a really really hard time reading 2 space indent, especially in larger code bases. Also, CamelCase is very very hard for me to read also, as is statements without spaces if((x<y&0xf)||z>a) for example.
So codestyle affects those with reading disabilities, but not well known to the people without these, which is why I was raising awareness.
Hope this helps to explain things?
Quoted 3 lines
Nicolas
Quoted 16 lines · Olliver Schinagl
Hey Nicolas,
Quoted 13 lines · Nicolas Pitre
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · Olliver Schinagl
Secondly, and more importantly so; you argue 'who cares about people with disablements, atleast its equally hard to read everywhere' which is a very poor argument :p
No, and I want to be
__very__clear about this: at no point I have argued "who cares about people with disabilities" or anything like it. It is insulting that you even suggest it.
Quoted 8 lines
Quoted 2 lines
What "people with disablements" have to do with this anyway? I don't get it.
If you are talking to me; simple, reading disabilities (dyslexia being the most common one) are real :) and code-style heavily impacts those.
For example, I have a really really hard time reading 2 space indent, especially in larger code bases. Also, CamelCase is very very hard for me to read also, as is statements without spaces
if((x<y&0xf)||z>a)for example.
OK, that's a good point.
I asked because such arguments are often brought up in the context of sight impairment by people who are not affected, and in this regard I'm well positioned to call those arguments unfounded.
Quoted 2 lines
So codestyle affects those with reading disabilities, but not well known to the people without these, which is why I was raising awareness.
Nicolas
Hey Miguel,
Just to make it very clear from the beginning, while this is a sensitive subject, and I am very passionate about it; In no way, I am being offensive, insulting or rude. This would be obvious in a f2f discussion of course, but alas. I do try to format my text as friendly as I can, but some things get lost in translation ;)
Quoted 10 lines · Miguel Ojeda
Quoted 3 lines · Olliver Schinagl
Absolutly, but with the many luitenants, many tree's, and not a single CI source, this would still be tricky in the end; but certainly possible.
A bot in -next (possibly an existing one) is a single thing to care about and the amount of maintainers/trees doesn't have an effect on it, thus I don't think it would be tricky.
Quoted 6 lines
Quoted 3 lines
I think this is a pretty poor argument for following Rust's opinionated view of the world. E.g. it's generally bad to copy/paste code to begin with. How many 'bugs' that we know of are copy/paste bugs?
We will have to disagree. Consistency and simplicity are fine arguments in my book, not "pretty poor" ones.
Consitency is absolutly important! Zero argument there. My argument is, the consistency should be within the kernel tree, not 'but the rest of the world is using style X/Y/Z, lets be consistent with that. In an utopia, maybe, but the real world doesn't work that way, sadly. So in an attempt to standardize (rustfmt) they just "invented" a new standard. Which btw is common, we see this happening every so often, right?
Quoted 4 lines
I don't see the relevance of the copy/paste code discussion here. But assuming the analogy makes sense, I don't agree that reusing code is "generally bad" either.
Copy/pasting is known to cause bugs. There's actually research from NASA on that. Code-reuse (libraries/functions) are not bad. But (worst kind of example) copy paste from stack-overflow, or copy/pasting stuff without actually looking at the content and forgetting to rename something, causes bugs. Why is this relevant? The whole 'lets be consistent with the rust codebase of the wrold' argument. E.g. if everybody uses the same style (which is idealistic and great) then copy/pasting becomes consistent. Where I say, try to be careful when copy/pasting code.
Quoted 5 lines
Anyway, given you mention "bugs", I think you are implying that the defaults are somehow "incorrect" (not accessible?). In that case, to improve things for all Rust developers out there, I would suggest opening an issue in https://github.com/rust-dev-tools/fmt-rfcs.
There have been, I've linked them in my first post; the devs basically say 'you are right, we are sorry; but this discussion is over' which reads as 'we love our style, we think its great, we're not changing it for people with reading-disabilitles, figure it out' (yes, I paraphrase it much harsher then what they state, but like with people in wheelchairs that run into a small staircase (1 or 2 treads), and then are being told, sorry, it is what it is, we can't fix this, it's been like this for years, it is what it is)
Quoted 8 lines
Quoted 4 lines
Secondly, and more importantly so; you argue 'who cares about people with disablements, atleast its equally hard to read everywhere' which is a very poor argument :p
No, and I want to be
__very__clear about this: at no point I have argued "who cares about people with disabilities" or anything like it. It is insulting that you even suggest it.
I appose for feeling insulted, that was surely not my intend! What I am stating however is, that by stating 'but rustfmt is great, their standard is consistent and simple and amazing', the message implies (nofi!) that reading disabilities do not matter, because this new standard is so great.
Quoted 2 lines
Likewise, you are the one claiming it is "hard to read", not me.
Yes, as I do suffer from a reading disability, so I know how hard this is :) but fear not, I'm not alone, just vocal.
Quoted 3 lines
And then after constructing those straw men, you call them "a very poor argument"...
Obviously I do not intend to cunstruct straw-men, as to me, this is all very real and painful :)
Quoted 7 lines
Quoted 4 lines
Finally, it must of course be mentioned, that rust is really trying to do an XKCD here, https://xkcd.com/927/ though I'm sure we'll get it right this time around ;)
How does that even apply here? There is no "standard" for formatting across languages, if that is what you are saying.
I'm not, I'm saying 'every language has its own standard(s), lets make one that is better then the others'. So instead of rust for example following the linux kernel standard (or the Go coding standard, or X/Y/Z), they came up with their own. Not bad, but as mentioned earlier, requires careful thinking. But it is of course their choice!
Quoted 6 lines
Actually, what is happening here is that there is an "official" tool, called rustfmt, that most Rust code out there uses.
By not using it, it is you the one that may be creating a XKCD situation, if anything.
No, do use it! rustfmt is pretty amazing. And rustfmt knows there's not a single answer on coding style, so the rustfmt tool, is super configurable trying to match any code-base needs, without forcing anybodies style. It is actually like you say, below, the defauflts that come from the rust group itself.
Quoted 4 lines
And to be clear, we don't necessarily follow "Rust's biased view". For instance, there is also an "official" build tool, called Cargo, that most Rust code out there uses; yet we are not using it for the kernel.
I'd prefer if we keep it to style and readability (rustfmt) :p as cargo is more a technical direction, and not relevant; but point noted.
Quoted 5 lines
We are actually doing things how we think are best for the kernel. Not because "Rust" (whatever or whoever that is) is "trying to do an XKCD". Not because we are "following Rust's opinionated view of the world" or "Rust's biased view".
But if that is the case, why not try to follow the kernels existing code-style as close as possible with the rust-fmt configuration? I know code-style has been discussed a few times over the decades; but not many changes have been done, surely, if there's some codestyle changes that are best for the kernel, they would have been 'advised'? '4 space indents are better then 8-size tabs, on new code, try to use them' for example :p
Quoted 10 lines
Quoted 7 lines
But you are not, only those that follow rust's biased view. Everybody else that has a different opinion (like die-hard C programmers) that care enough (I'm sure there's plenty) would setup their rustfmt config file to resemble their C code; and thus the entire premisis is broken. Though; yes, in a perfect world it could have worked like this, but xkcd again :)
No. I said we are being consistent with the majority of the Rust code out there, not with "everybody".
But why? Why should we not be consistent with the kernels' code-base (while yes, that is not rust, but C, but we can follow the same style?)
Quoted 5 lines
If, instead, we try to be consistent with the kernel C style, then you are likely not being consistent with the majority of the Rust code out there. And you would have to decide exactly how to map the C style to Rust constructs and which particular kernel style.
But is this a bad thing? Being consistent within the kernel repo? Who cares what the rest of the ruts code does? I know it matters for user-space; but I know that my user-space rust code (be it linux, or micro) actually follows the kernel style, not the rust style :p becaues of my disability, the rust format is not easy to read/parse in my head due to small inconsistencies.
Quoted 6 lines
Again: I personally don't mind what the particular style is. As a project, what we value the most is having a single style across it and not having to think about formatting. Nevertheless, I think there is also value in being consistent with the majority of the Rust code out there.
So I fully agree with the first part; but not with the last part :p As the rust code style, is poor on readability for people with reading-disabilities.
Quoted 10 lines
Quoted 7 lines
This though is a fair argument I understand, it would be weird in having 2 styles in user-space and kernel-space code; though I see this happening today as well; where developers follow kernel style for kernel code (obviously) but use their preferred 2 or 3 space style on their userland code. Trying to 'force' this, usually however never gets the intended result ...
If we follow the usual Rust style in the kernel, I would say it is more likely that both styles match.
That is of course the downside, that if user-space is writing their own code in their own style, it will either be rust-style, or something completly different, we have no control of this anyway; but having it 'match' is 'nice' from a consistency pov;
Sadly, I've seen so much vendor code (yeah, I know) which doesn't even have consistency in their own files ...
Quoted 2 lines
Cheers,
Miguel
Gary Guo
maintainerHi Olliver,
Quoted 7 lines · On Wed, 27 Jul 2022 10:05:31 +0200 Olliver Schinagl <[email protected]>…
Consitency is absolutly important! Zero argument there. My argument is, the consistency should be within the kernel tree, not 'but the rest of the world is using style X/Y/Z, lets be consistent with that. In an utopia, maybe, but the real world doesn't work that way, sadly. So in an attempt to standardize (rustfmt) they just "invented" a new standard. Which btw is common, we see this happening every so often, right?
Difference languages have different characteristics and I don't think it's necessarily good (and often isn't) to blindly apply coding style of one language onto another. So I don't see rustfmt as "inventing yet another standard" really, because there aren't many conflicting coding style standards in Rust world; almost everyone just settled on using rustfmt, mostly using the default, maybe with a few small project-specific configuration tweaks.
A small example for C and Rust differences:
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
if (condition) do_something();
Or
if (condition) do_something();
But in Rust it will be:
if condition {
do_something();
}That's just an example of one control flow constructions. There are differences between Rust match and C switch, etc. Rust's official coding style takes properties of Rust into consideration, so in many regards it's a more suitable coding style for Rust code in kernel, then applying kernel's C coding standard directly on kernel's Rust code.
Your earlier email in the thread also mentions about indentation, and I have a few things to point out as well.
First, Rust code typically requires more levels of indentation than C code. For example, many functions might be methods and they are inside an impl block, which creates one extra level of indentation. Statements inside match arms' block are two levels more indented than the match statement itself, as opposed to C's switch (as kernel coding style doesn't indent the case labels). As a result, 8 spaces for 1 level can be a bit excessive for Rust code, and thus the 4 space indentation used in rustfmt default.
Secondly, I don't think the argument about tabs being customisable holds; in kernel coding style tabs are strictly 8 characters. For line continuation it's not uncommon to use a series of tabs followed by a few spaces, e.g.
int function_name(int first_argument,
< tab >< tab >..int second_argument)
changing tab into 4 spaces will break the layout. (and I'll not go into well-known reasons about non-4-space-tab messing up code in terminal etc).
Quoted 9 lines
Copy/pasting is known to cause bugs. There's actually research from NASA on that. Code-reuse (libraries/functions) are not bad. But (worst kind of example) copy paste from stack-overflow, or copy/pasting stuff without actually looking at the content and forgetting to rename something, causes bugs. Why is this relevant? The whole 'lets be consistent with the rust codebase of the wrold' argument. E.g. if everybody uses the same style (which is idealistic and great) then copy/pasting becomes consistent. Where I say, try to be careful when copy/pasting code.
When we vendor in code as a whole (e.g. like we currently do for alloc crate), it is proper code reuse. With different coding style the vendored code either diverges from upstream (which makes upstreaming much more difficult) or diverge from rest of kernel's Rust code base.
Quoted 7 lines
But if that is the case, why not try to follow the kernels existing code-style as close as possible with the rust-fmt configuration? I know code-style has been discussed a few times over the decades; but not many changes have been done, surely, if there's some codestyle changes that are best for the kernel, they would have been 'advised'? '4 space indents are better then 8-size tabs, on new code, try to use them' for example :p
You do realize that you are creating a new coding style by doing this, right? It feels like creating problems rather than solving problems.
My personal feeling is that it's easier for me to adapt to different coding style when switching between languages, but it's rather awkward for me when trying to use different coding styles with the same language. I find myself no problem switching between 2 spaces when coding JavaScript to 4 spaces when coding Rust to 8 spaces(tab) when coding C, but it's rather painful to switch between C projects with different coding styles. I certainly don't want to switch between Rust projects with vastly different coding styles.
Quoted 3 lines
But why? Why should we not be consistent with the kernels' code-base (while yes, that is not rust, but C, but we can follow the same style?)
Difference languages have different characteristics, and one size doesn't fit them all :)
Quoted 2 lines
Sadly, I've seen so much vendor code (yeah, I know) which doesn't even have consistency in their own files ...
That's very true. So when all other Rust code currently follow (roughly) the same coding style and this situation doesn't currently exist, let's not make it worse...
Best,
Gary
Greg Kroah-Hartman
maintainerQuoted 4 lines · Gary Guo
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
if (condition) do_something();
That is not a valid kernel coding style, and our tools should catch this and prevent it from being added to the kernel tree.
thanks,
greg k-h
Gary Guo
maintainerQuoted 8 lines · On Thu, 28 Jul 2022 14:09:57 +0200 Greg Kroah-Hartman…
Quoted 4 lines · Gary Guo
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
if (condition) do_something();That is not a valid kernel coding style, and our tools should catch this and prevent it from being added to the kernel tree.
Thanks, I stand corrected. I do see those patterns occasionally so presumably that gives me wrong impression.
rg '\bif \(.*;' $(find -name *.c) | wc -l
gives me 3362 results though. Most of them are from fs and driver directory so presumably they are vendored or legacy code.
Best,
Gary
Hey Greg,
Quoted 8 lines · Greg Kroah-Hartman
Quoted 4 lines · Gary Guo
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
if (condition) do_something();That is not a valid kernel coding style, and our tools should catch this and prevent it from being added to the kernel tree.
Are you sure? I'm not sure if this isn't true today, but I've certainly seen old code where this definitely was done. Was all of this cleaned up in the last 2+ years?
Olliver
Quoted 4 lines
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 7 lines · Olliver Schinagl
Hey Greg,
Quoted 4 lines · Greg Kroah-Hartman
Quoted 3 lines · Gary Guo
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
if (condition) do_something();That is not a valid kernel coding style, and our tools should catch this and prevent it from being added to the kernel tree.
Are you sure? I'm not sure if this isn't true today, but I've certainly seen old code where this definitely was done. Was all of this cleaned up in the last 2+ years?
Given that I wrote about this back in 2002, and it was true then:
https://www.linuxjournal.com/article/5780 and: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.2.8887&rep=rep1&type=pdf
that is not anything new at all.
Yes, old code still survives that might not be correct, and some subsystems might have added code over time without the proper style, but our tools check that the above is not correct, you can check it yourself:
$ cat foo.c
// SPDX-License-Identifier: GPL-2.0
int foo(int baz)
{
if (baz == 1) do_something();
}$ ./scripts/checkpatch.pl --file --terse foo.c foo.c:4: ERROR: trailing statements should be on next line total: 1 errors, 0 warnings, 6 lines checked
thanks,
greg k-h
Hey Gary,
Quoted 13 lines · Gary Guo
Hi Olliver,
Quoted 7 lines · On Wed, 27 Jul 2022 10:05:31 +0200 Olliver Schinagl <[email protected]>…
Consitency is absolutly important! Zero argument there. My argument is, the consistency should be within the kernel tree, not 'but the rest of the world is using style X/Y/Z, lets be consistent with that. In an utopia, maybe, but the real world doesn't work that way, sadly. So in an attempt to standardize (rustfmt) they just "invented" a new standard. Which btw is common, we see this happening every so often, right?
Quoted 7 lines
Difference languages have different characteristics and I don't think it's necessarily good (and often isn't) to blindly apply coding style of one language onto another. So I don't see rustfmt as "inventing yet another standard" really, because there aren't many conflicting coding style standards in Rust world; almost everyone just settled on using rustfmt, mostly using the default, maybe with a few small project-specific configuration tweaks.
I was mostly arguing about a) lets look at this and b) having said configuration tweaks, rather then blindly (pun not really intended) going with rust's defaults :)
Quoted 10 lines
A small example for C and Rust differences:
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
if (condition) do_something();Or
Quoted 8 lines
if (condition) do_something();But in Rust it will be:
if condition { do_something(); }
So kernel style kind of says 'no braces around single statements'; but if your rust compiler doesn't allow this; well then there's nothing to do. You could even argue to update the kernel C style on this to make it consistent again. BUT, this inconsistency makes it cognative 'hard'. If this if a C or a rust function? for example during a review. During authoring, when writing both C and rust code (due to nececity, not constant context switching) you cognitivly constantly have to go back/foward. While I'm sure there's people here that can do this all day without problem, some of of find this harder then needs to be. Hence the request to _try_ to keep consistency within the kernel tree.
Quoted 19 lines
That's just an example of one control flow constructions. There are differences between Rust match and C switch, etc. Rust's official coding style takes properties of Rust into consideration, so in many regards it's a more suitable coding style for Rust code in kernel, then applying kernel's C coding standard directly on kernel's Rust code.
Your earlier email in the thread also mentions about indentation, and I have a few things to point out as well.
First, Rust code typically requires more levels of indentation than C code. For example, many functions might be methods and they are inside an impl block, which creates one extra level of indentation. Statements inside match arms' block are two levels more indented than the match statement itself, as opposed to C's switch (as kernel coding style doesn't indent the case labels). As a result, 8 spaces for 1 level can be a bit excessive for Rust code, and thus the 4 space indentation used in rustfmt default.
Quoted 2 lines
Secondly, I don't think the argument about tabs being customisable holds; in kernel coding style tabs are strictly 8 characters. For line
Sure, this rule implies that for alignment, tabs should be set to 8 so things align nicely. However, nobody forces people to set their editor to 8 character width. Not doing so, doesn't break anything. At worst, you may commit something that is poorly aligned (but we _should_ be using tabs to indent, spaces to align anyway :p, tab == indent has meaning).
With non-tab indentation, this is no longer really possible, or at least, editors haven't solved that problem yet, as it tends to still break (due to the mixing of indentation and alignment using a single character). Maybe once we have AI and ML in our editors though :p
Quoted 20 lines
continuation it's not uncommon to use a series of tabs followed by a few spaces, e.g.
int function_name(int
first_argument,
< tab >< tab >..intsecond_argument)changing tab into 4 spaces will break the layout. (and I'll not go into well-known reasons about non-4-space-tab messing up code in terminal etc).
Quoted 9 lines
Copy/pasting is known to cause bugs. There's actually research from NASA on that. Code-reuse (libraries/functions) are not bad. But (worst kind of example) copy paste from stack-overflow, or copy/pasting stuff without actually looking at the content and forgetting to rename something, causes bugs. Why is this relevant? The whole 'lets be consistent with the rust codebase of the wrold' argument. E.g. if everybody uses the same style (which is idealistic and great) then copy/pasting becomes consistent. Where I say, try to be careful when copy/pasting code.
Quoted 4 lines
When we vendor in code as a whole (e.g. like we currently do for alloc crate), it is proper code reuse. With different coding style the vendored code either diverges from upstream (which makes upstreaming much more difficult) or diverge from rest of kernel's Rust code base.
Very fair point of course. Though really, we should fix the upstream rust preferred format, but there it was already stated, that 'too bad, sorry' which from a developer point of view is fine, your project, your choice. From a disabilities point of view, sucks of course.
Quoted 12 lines
Quoted 8 lines
But if that is the case, why not try to follow the kernels existing code-style as close as possible with the rust-fmt configuration? I know code-style has been discussed a few times over the decades; but not many changes have been done, surely, if there's some codestyle changes that are best for the kernel, they would have been 'advised'? '4 space indents are better then 8-size tabs, on new code, try to use them' for example :p
You do realize that you are creating a new coding style by doing this, right? It feels like creating problems rather than solving problems.
Quoted 8 lines
My personal feeling is that it's easier for me to adapt to different coding style when switching between languages, but it's rather awkward for me when trying to use different coding styles with the same language. I find myself no problem switching between 2 spaces when coding JavaScript to 4 spaces when coding Rust to 8 spaces(tab) when coding C, but it's rather painful to switch between C projects with different coding styles. I certainly don't want to switch between Rust projects with vastly different coding styles.
And I'm happy for you that you can easily take in 2 and 4 spaces. For me, it is extremly hard to read. So it's not a 'personal preference' thing. But I suggest to read the earlier posted links, where others at length explain it as well, how it is like to feel excluded becaues its just hard to read.
Quoted 7 lines
Quoted 4 lines
But why? Why should we not be consistent with the kernels' code-base (while yes, that is not rust, but C, but we can follow the same style?)
Difference languages have different characteristics, and one size doesn't fit them all :)
I'm not even arguing this at all :)
I think the biggest issues i'm speaking of really are the braces and the spaces really, where the braces can be argued for/against, it's cognitive harder, but can be dealth with (and we can expect inconsitencies; but the sapces vs tabs thing, personal configuration vs forced with is the point I was trying to raise.
As said before, 'every building is different, some offer wheelchair ramps, others do' kind of point, not like 'this building is red, and that one is blue, and not every color fits all :p
Quoted 10 lines
Quoted 3 lines
Sadly, I've seen so much vendor code (yeah, I know) which doesn't even have consistency in their own files ...
That's very true. So when all other Rust code currently follow (roughly) the same coding style and this situation doesn't currently exist, let's not make it worse...
Best,
Gary
As this thread kind of went silent and as the 'big merge' for this feature is getting closer, here a final plee, inspired by this slashdot post [0].
The post in itself speaks of a new team forming on working on the Rust styleguide, which in itself is still evolving. This makes sense, rust is new, it's not very commonly in use and as with all good things, they evolve.
One comment in that slashdot post [1] I want to bring forward and quote a piece of:
"i created a new repository, and thought i was being hip and modern, so i started to evangelize spaces for the 'consistency across environments'
i get approached by not one, but TWO coworkers who unfortunately are highly visually impaired and each has a different visual impairment
at that moment, i instantaneously conceded — there's just no counter-argument that even comes close to outweighing the accessibility needs of valued coworkers"
Visual impairness is a thing, it does not make someone smarter or dumber. Helping those with visual impairments should be concidered, and not shunted off by saying 'but the rust guys came up with the perfect style, so we should use it'.
Find attached, a diff to the .rustfmt.toml, that should keep things more consistent with the current kernel style.
I'll leave it now to Linus and Greg to concsider this, and will keep my peace (though I hope they actually read it :p).
Olliver
[0]: https://developers.slashdot.org/story/22/10/07/2351222/rust-programming-language-announces-new-team-to-evolve-official-coding-style
[1]: https://developers.slashdot.org/comments.pl?sid=22182701&cid=62949323
Quoted 158 lines · Olliver Schinagl
Hey Gary,
Quoted 13 lines · Gary Guo
Hi Olliver,
Quoted 7 lines · On Wed, 27 Jul 2022 10:05:31 +0200 Olliver Schinagl <[email protected]>…
Consitency is absolutly important! Zero argument there. My argument is, the consistency should be within the kernel tree, not 'but the rest of the world is using style X/Y/Z, lets be consistent with that. In an utopia, maybe, but the real world doesn't work that way, sadly. So in an attempt to standardize (rustfmt) they just "invented" a new standard. Which btw is common, we see this happening every so often, right?
Quoted 7 lines
Difference languages have different characteristics and I don't think it's necessarily good (and often isn't) to blindly apply coding style of one language onto another. So I don't see rustfmt as "inventing yet another standard" really, because there aren't many conflicting coding style standards in Rust world; almost everyone just settled on using rustfmt, mostly using the default, maybe with a few small project-specific configuration tweaks.
I was mostly arguing about a) lets look at this and b) having said configuration tweaks, rather then blindly (pun not really intended) going with rust's defaults :)
Quoted 10 lines
A small example for C and Rust differences:
Rust requires braces around branches of if expression, and C doesn't. So in kernel coding style you often have:
if (condition) do_something();Or
Quoted 8 lines
if (condition) do_something();But in Rust it will be:
if condition { do_something(); }So kernel style kind of says 'no braces around single statements'; but if your rust compiler doesn't allow this; well then there's nothing to do. You could even argue to update the kernel C style on this to make it consistent again. BUT, this inconsistency makes it cognative 'hard'. If this if a C or a rust function? for example during a review. During authoring, when writing both C and rust code (due to nececity, not constant context switching) you cognitivly constantly have to go back/foward. While I'm sure there's people here that can do this all day without problem, some of of find this harder then needs to be. Hence the request to _try_ to keep consistency within the kernel tree.
Quoted 19 lines
That's just an example of one control flow constructions. There are differences between Rust match and C switch, etc. Rust's official coding style takes properties of Rust into consideration, so in many regards it's a more suitable coding style for Rust code in kernel, then applying kernel's C coding standard directly on kernel's Rust code.
Your earlier email in the thread also mentions about indentation, and I have a few things to point out as well.
First, Rust code typically requires more levels of indentation than C code. For example, many functions might be methods and they are inside an impl block, which creates one extra level of indentation. Statements inside match arms' block are two levels more indented than the match statement itself, as opposed to C's switch (as kernel coding style doesn't indent the case labels). As a result, 8 spaces for 1 level can be a bit excessive for Rust code, and thus the 4 space indentation used in rustfmt default.
Quoted 2 lines
Secondly, I don't think the argument about tabs being customisable holds; in kernel coding style tabs are strictly 8 characters. For line
Sure, this rule implies that for alignment, tabs should be set to 8 so things align nicely. However, nobody forces people to set their editor to 8 character width. Not doing so, doesn't break anything. At worst, you may commit something that is poorly aligned (but we _should_ be using tabs to indent, spaces to align anyway :p, tab == indent has meaning).
With non-tab indentation, this is no longer really possible, or at least, editors haven't solved that problem yet, as it tends to still break (due to the mixing of indentation and alignment using a single character). Maybe once we have AI and ML in our editors though :p
Quoted 20 lines
continuation it's not uncommon to use a series of tabs followed by a few spaces, e.g.
int function_name(int
first_argument,
< tab >< tab >..intsecond_argument)changing tab into 4 spaces will break the layout. (and I'll not go into well-known reasons about non-4-space-tab messing up code in terminal etc).
Quoted 9 lines
Copy/pasting is known to cause bugs. There's actually research from NASA on that. Code-reuse (libraries/functions) are not bad. But (worst kind of example) copy paste from stack-overflow, or copy/pasting stuff without actually looking at the content and forgetting to rename something, causes bugs. Why is this relevant? The whole 'lets be consistent with the rust codebase of the wrold' argument. E.g. if everybody uses the same style (which is idealistic and great) then copy/pasting becomes consistent. Where I say, try to be careful when copy/pasting code.
Quoted 4 lines
When we vendor in code as a whole (e.g. like we currently do for alloc crate), it is proper code reuse. With different coding style the vendored code either diverges from upstream (which makes upstreaming much more difficult) or diverge from rest of kernel's Rust code base.
Very fair point of course. Though really, we should fix the upstream rust preferred format, but there it was already stated, that 'too bad, sorry' which from a developer point of view is fine, your project, your choice. From a disabilities point of view, sucks of course.
Quoted 12 lines
Quoted 8 lines
But if that is the case, why not try to follow the kernels existing code-style as close as possible with the rust-fmt configuration? I know code-style has been discussed a few times over the decades; but not many changes have been done, surely, if there's some codestyle changes that are best for the kernel, they would have been 'advised'? '4 space indents are better then 8-size tabs, on new code, try to use them' for example :p
You do realize that you are creating a new coding style by doing this, right? It feels like creating problems rather than solving problems.
Quoted 8 lines
My personal feeling is that it's easier for me to adapt to different coding style when switching between languages, but it's rather awkward for me when trying to use different coding styles with the same language. I find myself no problem switching between 2 spaces when coding JavaScript to 4 spaces when coding Rust to 8 spaces(tab) when coding C, but it's rather painful to switch between C projects with different coding styles. I certainly don't want to switch between Rust projects with vastly different coding styles.
And I'm happy for you that you can easily take in 2 and 4 spaces. For me, it is extremly hard to read. So it's not a 'personal preference' thing. But I suggest to read the earlier posted links, where others at length explain it as well, how it is like to feel excluded becaues its just hard to read.
Quoted 7 lines
Quoted 4 lines
But why? Why should we not be consistent with the kernels' code-base (while yes, that is not rust, but C, but we can follow the same style?)
Difference languages have different characteristics, and one size doesn't fit them all :)
I'm not even arguing this at all :)
I think the biggest issues i'm speaking of really are the braces and the spaces really, where the braces can be argued for/against, it's cognitive harder, but can be dealth with (and we can expect inconsitencies; but the sapces vs tabs thing, personal configuration vs forced with is the point I was trying to raise.
Quoted 15 lines
As said before, 'every building is different, some offer wheelchair ramps, others do' kind of point, not like 'this building is red, and that one is blue, and not every color fits all :p
Quoted 10 lines
Quoted 3 lines
Sadly, I've seen so much vendor code (yeah, I know) which doesn't even have consistency in their own files ...
That's very true. So when all other Rust code currently follow (roughly) the same coding style and this situation doesn't currently exist, let's not make it worse...
Best,
Gary
From 0ac1e56435e27adddef9806dbf1134f909e99dd4 Mon Sep 17 00:00:00 2001
From: Olliver Schinagl <[email protected]>
Date: Sat, 15 Oct 2022 16:09:06 +0200
Subject: [PATCH] rustfmt: Match style with kernel codestyle
--- .rustfmt.toml | 8 ++++++++ 1 file changed, 8 insertions(+)
.rustfmt.toml +8 -0
@@ -1,5 +1,13 @@ +binop_separator = "Back" +brace_style = "AlwaysNextLine" +control_brace_style = "AlwaysSameLine" edition = "2021" +hard_tabs = "true" +indent_style = "Visual" +match_block_trailing_comma = "true" newline_style = "Unix" +struct_lit_single_line = "false" +tab_spaces = "8" # Unstable options that help catching some mistakes in formatting and that we may want to enable # when they become stable.
Signature · 1 line
2.38.0
Quoted 10 lines · Olliver Schinagl
As this thread kind of went silent and as the 'big merge' for this feature is getting closer, here a final plee, inspired by this slashdot post [0].
The post in itself speaks of a new team forming on working on the Rust styleguide, which in itself is still evolving. This makes sense, rust is new, it's not very commonly in use and as with all good things, they evolve.
One comment in that slashdot post [1] I want to bring forward and quote a piece of:
"i created a new repository, and thought i was being hip and modern, so i started to evangelize spaces for the 'consistency across environments'i get approached by not one, but TWO coworkers who unfortunately are highly visually impaired and each has a different visual impairment
Quoted 8 lines
at that moment, i instantaneously conceded — there's just no counter-argument that even comes close to outweighing the accessibility needs of valued coworkers"
Visual impairness is a thing, it does not make someone smarter or dumber. Helping those with visual impairments should be concidered, and not shunted off by saying 'but the rust guys came up with the perfect style, so we should use it'.
Find attached, a diff to the .rustfmt.toml, that should keep things more consistent with the current kernel style.
I'll leave it now to Linus and Greg to concsider this, and will keep my peace (though I hope they actually read it :p).
I have to say two advices:
First, don't top-post. I don't know what context you're replying to (in fact I have to cut the reply context below your message).
Second, please post the patch inline, not attached. git format-patch + git send-email should suffice.
Thanks.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 9 lines · Bagas Sanjaya
I have to say two advices:
First, don't top-post. I don't know what context you're replying to (in fact I have to cut the reply context below your message).
Second, please post the patch inline, not attached. git format-patch + git send-email should suffice.
Oh, I forget to mention this. Is it RFC? If so, you need to specify --subject-prefix="RFC PATCH" to git format-patch.
Thanks.
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 1 line · Olliver Schinagl
+indent_style = "Visual"
Without commenting on the rest of this: visual indent style produces a *lot* of diff noise, and I'd strongly recommend against it. Because it lines things up, a change to one line can change many adjacent lines, and make it hard to see what actually changed.