[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CCB6D89D-D513-4514-8992-AC37313F5588@collabora.com>
Date: Tue, 1 Apr 2025 09:58:40 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Tamir Duberstein <tamird@...il.com>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Boris-Chengbiao Zhou <bobo1239@....de>,
Kees Cook <kees@...nel.org>,
Fiona Behrens <me@...enk.dev>,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
Lukas Wirth <lukas.wirth@...rous-systems.com>
Subject: Re: [PATCH v5 07/13] scripts: generate_rust_analyzer.py: avoid
optional arguments
Hi Tamir,
This patch looks good to me but,
> On 25 Mar 2025, at 17:06, Tamir Duberstein <tamird@...il.com> wrote:
>
> Make all arguments required to reduce the probability of incorrect
> implicit behavior. Use keyword arguments for clarity.
>
> Signed-off-by: Tamir Duberstein <tamird@...il.com>
> ---
> scripts/generate_rust_analyzer.py | 90 +++++++++++++++++++++++++++------------
> 1 file changed, 62 insertions(+), 28 deletions(-)
>
> diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
> index b37d8345486a..badcef4126cf 100755
> --- a/scripts/generate_rust_analyzer.py
> +++ b/scripts/generate_rust_analyzer.py
> @@ -69,9 +69,10 @@ def generate_crates(
> def build_crate(
> display_name: str,
> root_module: pathlib.Path,
> + *,
> deps: List[str],
> - cfg: List[str] = [],
> - is_workspace_member: bool = True,
> + cfg: List[str],
> + is_workspace_member: bool,
> ) -> Crate:
> return {
> "display_name": display_name,
> @@ -92,21 +93,34 @@ def generate_crates(
> def append_crate(
> display_name: str,
> root_module: pathlib.Path,
> + *,
> deps: List[str],
> - cfg: List[str] = [],
> - is_workspace_member: bool = True,
> + cfg: List[str],
> ) -> None:
> register_crate(
> - build_crate(display_name, root_module, deps, cfg, is_workspace_member)
> + build_crate(
> + display_name,
> + root_module,
> + deps=deps,
> + cfg=cfg,
> + is_workspace_member=True,
> + )
> )
>
> def append_proc_macro_crate(
> display_name: str,
> root_module: pathlib.Path,
> + *,
> deps: List[str],
> - cfg: List[str] = [],
> + cfg: List[str],
> ) -> None:
> - crate = build_crate(display_name, root_module, deps, cfg)
> + crate = build_crate(
> + display_name,
> + root_module,
> + deps=deps,
> + cfg=cfg,
> + is_workspace_member=True,
> + )
> proc_macro_dylib_name = (
> subprocess.check_output(
> [
> @@ -133,66 +147,75 @@ def generate_crates(
>
> def append_sysroot_crate(
> display_name: str,
> + *,
> deps: List[str],
> - cfg: List[str] = [],
> + cfg: List[str],
> ) -> None:
> - append_crate(
> - display_name,
> - sysroot_src / display_name / "src" / "lib.rs",
> - deps,
> - cfg,
> - is_workspace_member=False,
> + register_crate(
> + build_crate(
> + display_name,
> + sysroot_src / display_name / "src" / "lib.rs",
> + deps=deps,
> + cfg=cfg,
> + is_workspace_member=False,
> + )
> )
Why the change from append to register+build here? Maybe this change
should be in another patch?
— Daniel
Powered by blists - more mailing lists