lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ-ks9mNZWrAaHChU6kXHOKcwUkL4MJ1ENjuTPBaE8CKrEYQPA@mail.gmail.com>
Date: Mon, 31 Mar 2025 13:47:10 -0400
From: Tamir Duberstein <tamird@...il.com>
To: Daniel Almeida <daniel.almeida@...labora.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 06/13] scripts: generate_rust_analyzer.py: add type hints

On Mon, Mar 31, 2025 at 1:09 PM Daniel Almeida
<daniel.almeida@...labora.com> wrote:
>
> Hi Tamir,
>
> [snip]
>
> >     rust_project = {
> > -        "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs),
> > +        "crates": generate_crates(
> > +            args.srctree,
> > +            args.objtree,
> > +            args.sysroot_src,
> > +            args.exttree,
> > +            defaultdict(
> > +                list,
> > +                {
> > +                    crate: vals.lstrip("--cfg").split()
> > +                    for crate, vals in map(lambda cfg: cfg.split("=", 1), args.cfgs)
> > +                },
> > +            ),
> > +        ),
> >         "sysroot": str(args.sysroot),
> >     }
> >
> >
> > --
> > 2.49.0
> >
>
> I found `args_crates_cfgs()` a lot easier to understand, but I guess this is a
> matter of taste. I also find that this `defaultdict()` call slightly pollutes
> the surrounding code, but again, that might be just me.

Would extracting a local variable suffice?

> Regardless, running `mypy` still passes, and there is no change to the output.
>
> Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ