patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: Miguel Ojeda <ojeda@kernel.org>
Cc: "Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev
Subject: Re: [PATCH 00/19] rust: lint improvements
Date: Sun, 15 Sep 2024 00:19:46 +0100	[thread overview]
Message-ID: <20240915001946.2cf237cc.gary@garyguo.net> (raw)
In-Reply-To: <20240904204347.168520-1-ojeda@kernel.org>

On Wed,  4 Sep 2024 22:43:28 +0200
Miguel Ojeda <ojeda@kernel.org> wrote:

> Hi all,
> 
> This is a series that contains a series of lint-related things:
> 
>   - Cleanups and other improvements and fixes, including removing `allow`s that
>     are not needed anymore for different reasons and a workaround for
>     `dbg_macro` detection.
> 
>   - The enablement of some safety lints so that the toolchain enforces that we
>     write `// SAFETY` comments and `# Safety` sections properly.
> 
>   - The addition of `.clippy.toml`, which allows us to take advantage of a few
>     configuration options.
> 
>   - Start using the new `#[expect(...)]` feature and add documentation on it as
>     well as lints in general.
> 
> Overall, this should improve the quality of the code and documentation as well
> as reduce the time needed in reviews.
> 
> I want to mention Trevor's nice work on lints from a while ago [1]. I think we
> should still do something like that: discuss which lints we would like to have
> one-by-one and start enabling them (and perhaps have a file like Trevor proposed
> etc.).
> 
> For the moment, though, I am sending these, since we would like to have at least
> the safety-related ones enabled soon [2]: now that more code and developers
> are joining, it sounds like a good time to start enforcing it -- it should make
> new Rust kernel developers aware of the need of writing them, which has proven
> to be a common request from reviewers.
> 
> If needed, the series can be applied partially or split, but most of it should
> be fairly uncontroversial.
> 
> Link: https://github.com/Rust-for-Linux/linux/pull/1025 [1]
> Link: https://lore.kernel.org/rust-for-linux/CD29DF8F-7FF3-466F-9724-BC92C14A68BD@collabora.com/ [2]

Built with clippy locally and it's all clean.

Tested-by: Gary Guo <gary@garyguo.net>

Apart from one `#[]`/`#![]` modification - which I think is fine as
long as it's intentional, everything LGTM.

Reviewed-by: Gary Guo <gary@garyguo.net>


> 
> Miguel Ojeda (19):
>   rust: workqueue: remove unneeded ``#[allow(clippy::new_ret_no_self)]`
>   rust: sort global Rust flags
>   rust: types: avoid repetition in `{As,From}Bytes` impls
>   rust: enable `clippy::undocumented_unsafe_blocks` lint
>   rust: enable `clippy::unnecessary_safety_comment` lint
>   rust: enable `clippy::unnecessary_safety_doc` lint
>   rust: enable `clippy::ignored_unit_patterns` lint
>   rust: enable `rustdoc::unescaped_backticks` lint
>   rust: init: remove unneeded `#[allow(clippy::disallowed_names)]`
>   rust: sync: remove unneeded
>     `#[allow(clippy::non_send_fields_in_send_ty)]`
>   rust: introduce `.clippy.toml`
>   rust: replace `clippy::dbg_macro` with `disallowed_macros`
>   rust: rbtree: fix `SAFETY` comments that should be `# Safety` sections
>   rust: provide proper code documentation titles
>   rust: enable Clippy's `check-private-items`
>   Documentation: rust: add coding guidelines on lints
>   rust: start using the `#[expect(...)]` attribute
>   Documentation: rust: discuss `#[expect(...)]` in the guidelines
>   rust: std_vendor: simplify `{ .. macro! .. }` with inner attributes
> 
>  .clippy.toml                             |   9 ++
>  .gitignore                               |   1 +
>  Documentation/rust/coding-guidelines.rst | 139 +++++++++++++++++++++++
>  MAINTAINERS                              |   1 +
>  Makefile                                 |  15 ++-
>  rust/Makefile                            |   5 +-
>  rust/bindings/lib.rs                     |   1 +
>  rust/kernel/alloc/allocator.rs           |   2 +
>  rust/kernel/error.rs                     |  11 +-
>  rust/kernel/init.rs                      |  30 ++---
>  rust/kernel/init/__internal.rs           |  11 +-
>  rust/kernel/init/macros.rs               |  18 ++-
>  rust/kernel/ioctl.rs                     |   2 +-
>  rust/kernel/lib.rs                       |   1 +
>  rust/kernel/list.rs                      |   1 +
>  rust/kernel/list/arc_field.rs            |   2 +-
>  rust/kernel/print.rs                     |   5 +-
>  rust/kernel/rbtree.rs                    |   9 +-
>  rust/kernel/std_vendor.rs                |  16 ++-
>  rust/kernel/str.rs                       |   7 +-
>  rust/kernel/sync/arc.rs                  |   2 +-
>  rust/kernel/sync/arc/std_vendor.rs       |   2 +
>  rust/kernel/sync/condvar.rs              |   1 -
>  rust/kernel/sync/lock.rs                 |   6 +-
>  rust/kernel/types.rs                     |  74 ++++++------
>  rust/kernel/workqueue.rs                 |   9 +-
>  rust/uapi/lib.rs                         |   1 +
>  samples/rust/rust_print.rs               |   1 +
>  scripts/Makefile.build                   |   2 +-
>  29 files changed, 293 insertions(+), 91 deletions(-)
>  create mode 100644 .clippy.toml
> 
> 
> base-commit: 68d3b6aa08708bb3907c2c13eaf4b3ccf4805160
> --
> 2.46.0


  parent reply	other threads:[~2024-09-14 23:19 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 20:43 [PATCH 00/19] rust: lint improvements Miguel Ojeda
2024-09-04 20:43 ` [PATCH 01/19] rust: workqueue: remove unneeded ``#[allow(clippy::new_ret_no_self)]` Miguel Ojeda
2024-09-05  7:57   ` Alice Ryhl
2024-09-29  4:17   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 02/19] rust: sort global Rust flags Miguel Ojeda
2024-09-05  7:57   ` Alice Ryhl
2024-09-29  4:18   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 03/19] rust: types: avoid repetition in `{As,From}Bytes` impls Miguel Ojeda
2024-09-05  7:58   ` Alice Ryhl
2024-09-29  4:20   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 04/19] rust: enable `clippy::undocumented_unsafe_blocks` lint Miguel Ojeda
2024-09-05  8:04   ` Alice Ryhl
2024-09-29  4:33   ` Trevor Gross
2024-10-03 18:45     ` Miguel Ojeda
2024-09-04 20:43 ` [PATCH 05/19] rust: enable `clippy::unnecessary_safety_comment` lint Miguel Ojeda
2024-09-05  8:07   ` Alice Ryhl
2024-09-08  7:38   ` Vincenzo Palazzo
2024-09-29  4:35   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 06/19] rust: enable `clippy::unnecessary_safety_doc` lint Miguel Ojeda
2024-09-05  8:07   ` Alice Ryhl
2024-09-29  4:35   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 07/19] rust: enable `clippy::ignored_unit_patterns` lint Miguel Ojeda
2024-09-05  8:08   ` Alice Ryhl
2024-09-29  4:37   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 08/19] rust: enable `rustdoc::unescaped_backticks` lint Miguel Ojeda
2024-09-05  8:09   ` Alice Ryhl
2024-09-29  4:40   ` Trevor Gross
2024-10-01 17:06     ` Miguel Ojeda
2024-09-04 20:43 ` [PATCH 09/19] rust: init: remove unneeded `#[allow(clippy::disallowed_names)]` Miguel Ojeda
2024-09-05  8:10   ` Alice Ryhl
2024-09-29  4:41   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 10/19] rust: sync: remove unneeded `#[allow(clippy::non_send_fields_in_send_ty)]` Miguel Ojeda
2024-09-05  8:10   ` Alice Ryhl
2024-09-29  4:41   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 11/19] rust: introduce `.clippy.toml` Miguel Ojeda
2024-09-05  8:12   ` Alice Ryhl
2024-09-29  4:48   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 12/19] rust: replace `clippy::dbg_macro` with `disallowed_macros` Miguel Ojeda
2024-09-05  5:20   ` Geert Stappers
2024-09-14 23:10     ` Gary Guo
2024-10-03 18:43       ` Miguel Ojeda
2024-09-04 20:43 ` [PATCH 13/19] rust: rbtree: fix `SAFETY` comments that should be `# Safety` sections Miguel Ojeda
2024-09-05  8:12   ` Alice Ryhl
2024-09-29  4:51   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 14/19] rust: provide proper code documentation titles Miguel Ojeda
2024-09-05  8:13   ` Alice Ryhl
2024-09-29  4:56   ` Trevor Gross
2024-10-03 18:44     ` Miguel Ojeda
2024-09-04 20:43 ` [PATCH 15/19] rust: enable Clippy's `check-private-items` Miguel Ojeda
2024-09-05  8:14   ` Alice Ryhl
2024-09-29  4:57   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 16/19] Documentation: rust: add coding guidelines on lints Miguel Ojeda
2024-09-05  8:15   ` Alice Ryhl
2024-09-05  9:45     ` Miguel Ojeda
2024-09-07 22:22       ` comex
2024-10-01 17:07         ` Miguel Ojeda
2024-10-03 20:00       ` Miguel Ojeda
2024-09-29  5:03   ` Trevor Gross
2024-10-03 18:47     ` Miguel Ojeda
2024-09-04 20:43 ` [PATCH 17/19] rust: start using the `#[expect(...)]` attribute Miguel Ojeda
2024-09-05  8:17   ` Alice Ryhl
2024-09-29  5:05   ` Trevor Gross
2024-09-04 20:43 ` [PATCH 18/19] Documentation: rust: discuss `#[expect(...)]` in the guidelines Miguel Ojeda
2024-09-29  5:10   ` Trevor Gross
2024-10-01 17:11     ` Miguel Ojeda
2024-09-04 20:43 ` [PATCH 19/19] rust: std_vendor: simplify `{ .. macro! .. }` with inner attributes Miguel Ojeda
2024-09-05  8:19   ` Alice Ryhl
2024-09-05  9:27     ` Miguel Ojeda
2024-09-05  9:41       ` Alice Ryhl
2024-09-08  8:50   ` Vincenzo Palazzo
2024-09-14 23:19 ` Gary Guo [this message]
2024-10-03 21:51 ` [PATCH 00/19] rust: lint improvements Miguel Ojeda

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=20240915001946.2cf237cc.gary@garyguo.net \
    --to=gary@garyguo.net \
    --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=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --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).