From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Danilo Krummrich <dakr@redhat.com>
Cc: Alice Ryhl <aliceryhl@google.com>,
a.hindborg@samsung.com, alex.gaynor@gmail.com,
benno.lossin@proton.me, bjorn3_gh@protonmail.com,
boqun.feng@gmail.com, gary@garyguo.net,
linux-kernel@vger.kernel.org, ojeda@kernel.org,
rust-for-linux@vger.kernel.org, wedsonaf@gmail.com
Subject: Re: [PATCH v4] rust: str: add {make,to}_{upper,lower}case() to CString
Date: Tue, 20 Feb 2024 16:04:20 +0100 [thread overview]
Message-ID: <CANiq72nVkV3+1rt4Mi+Own6KGAzmvR2jf8fFsp9NBu_gy_ob5g@mail.gmail.com> (raw)
In-Reply-To: <e543b270-dea7-477a-b83d-62129d4ac708@redhat.com>
On Tue, Feb 20, 2024 at 1:03 PM Danilo Krummrich <dakr@redhat.com> wrote:
>
> That's the worst rationale I could think of. Without further rationale what that
> should mean and why this would be good, it's entirely meaningless.
Probably whoever wrote that did not feel the need to explain further
because it is the convention, but please feel free to open an issue/PR
to Clippy about improving the wording of that text.
The convention itself, however, you will find way harder to change
everywhere else.
> Instead, I'd argue that keeping it gives kernel people, who necessarily need to
> deal with both, Rust *and* C, more consistency in kernel code.
That sounds to me like trying to keep consistency in style/formatting
between two languages, which is something we have discussed quite a
few times in the past.
We are keeping Rust code as idiomatic as possible, except where it may
actually make sense to diverge for kernel reasons.
But this one does not seem to be the case:
- It is inconsistent with most Rust code out there.
- It is inconsistent with all Rust kernel code.
- It is inconsistent with learning material, which kernel developers use too.
- It introduces 2 ways for writing the same trivial thing.
- Rust is a more expression-oriented language than C.
And, by the way, your patch does use both ways. Why aren't you
explicit when it is a single expression too?
> At least, this shouldn't be fatal IMHO.
For some of the compiler-based (i.e. not Clippy) and that may make
prototyping a bad experience, I could agree (e.g. like missing
documentation is already a warning).
But please note that patches must be warning free anyway, so it is not
like this patch would have been OK.
> Similar story here. Why is it bad, and even *fatal*, to be explicit?
This one is more arguable, and could be discussed. In fact, we planned
going through some of the lints in a meeting to see, mostly, what
extra lints could be enabled etc. You are welcome to join if that
happens (I think Trevor wanted to drive that discussion).
> Again, not a great rationale, this is entirely subjective and might even depend
> on the context of the project. Again, for kernel people who need to deal with Rust
> *and* C continuously it might be better to be explicit.
That is fine, but to decide on this like this, we need better examples
and rationale than just "it might be better" (and please note that
whatever Clippy says is not important, so complaining about their docs
being lacking is not really an argument to change kernel code).
Cheers,
Miguel
next prev parent reply other threads:[~2024-02-20 15:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 16:39 [PATCH v4] rust: str: add {make,to}_{upper,lower}case() to CString Danilo Krummrich
2024-02-20 9:35 ` Alice Ryhl
2024-02-20 12:02 ` Danilo Krummrich
2024-02-20 13:17 ` Alice Ryhl
2024-02-20 14:53 ` Danilo Krummrich
2024-02-20 15:45 ` Miguel Ojeda
2024-02-20 19:55 ` Danilo Krummrich
2024-02-20 15:04 ` Miguel Ojeda [this message]
2024-02-20 15:53 ` Danilo Krummrich
2024-02-20 16:53 ` Miguel Ojeda
2024-02-20 19:55 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANiq72nVkV3+1rt4Mi+Own6KGAzmvR2jf8fFsp9NBu_gy_ob5g@mail.gmail.com \
--to=miguel.ojeda.sandonis@gmail.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@redhat.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).