[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ-ks9m=JZKrsSkuk8mefiAU5EroNMMkyKN5pkqNN1TYJSySFw@mail.gmail.com>
Date: Thu, 17 Apr 2025 09:10:56 -0400
From: Tamir Duberstein <tamird@...il.com>
To: Trevor Gross <tmgross@...ch.edu>
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>, 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>,
Daniel Almeida <daniel.almeida@...labora.com>
Subject: Re: [PATCH v5 12/13] scripts: generate_rust_analyzer.py: define scripts
On Thu, Apr 17, 2025 at 3:25 AM Trevor Gross <tmgross@...ch.edu> wrote:
>
> On Tue, Mar 25, 2025 at 3:07 PM Tamir Duberstein <tamird@...il.com> wrote:
> >
> > Generate rust-project.json entries for scripts written in Rust. This is
> > possible now that we have a definition for `std` built for the host.
> >
> > Use `str::rstrip` for consistency.
> >
> > Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
> > Tested-by: Daniel Almeida <daniel.almeida@...labora.com>
> > Reviewed-by: Fiona Behrens <me@...enk.dev>
> > Signed-off-by: Tamir Duberstein <tamird@...il.com>
> > ---
> > scripts/generate_rust_analyzer.py | 16 +++++++++++++++-
> > 1 file changed, 15 insertions(+), 1 deletion(-)
>
> > + with open(scripts / "Makefile") as f:
> > + makefile = f.read()
>
> Since we are using pathlib, this can be `makefile = (scripts /
> "Makefile").open().read()`
I assume you mean `makefile = (scripts / "Makefile").read_text()`;
`.open().read()` would leak a file descriptor.
>
> > + for path in scripts.glob("*.rs"):
> > + name = path.name.rstrip(".rs")
>
> `stem` should provide the file name without extension, so
>
> name = path.stem
>
> > @@ -267,7 +281,7 @@ def generate_crates(
> > for folder in extra_dirs:
> > for path in folder.rglob("*.rs"):
> > logging.info("Checking %s", path)
> > - name = path.name.replace(".rs", "")
> > + name = path.name.rstrip(".rs")
>
> The above applies here too.
>
> A couple of optional nits if you resend but nothing to block on:
>
> Reviewed-by: Trevor Gross <tmgross@...ch.edu>
Powered by blists - more mailing lists