[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <C58B27D5-7F61-46D1-84F3-CC69E01EF5C4@collabora.com>
Date: Thu, 17 Apr 2025 08:17:28 -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,
> On 1 Apr 2025, at 10:34, Tamir Duberstein <tamird@...il.com> wrote:
>
> On Tue, Apr 1, 2025 at 8:59 AM Daniel Almeida
> <daniel.almeida@...labora.com> wrote:
>>
>> 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?
>
> The reason is that `append_crate` has lost its `is_workspace_member`
> parameter, so the only way to pass `False` now is to use
> `build_crate`. I chose to remove the argument from `append_crate`
> because the alternative would have introduced many instances of
> `is_workspace_member=True`, which I judged to be less-good than this.
Fine with me.
Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
>
> Cheers.
> Tamir
— Daniel
Powered by blists - more mailing lists