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: <4919d080-43e4-41e3-a392-fddb1aac2666@app.fastmail.com>
Date: Thu, 30 Jan 2025 07:08:04 +0100
From: "Anisse Astier" <anisse@...ier.eu>
To: "Viresh Kumar" <viresh.kumar@...aro.org>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>,
 "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>,
 linux-pm@...r.kernel.org, "Vincent Guittot" <vincent.guittot@...aro.org>,
 linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2] rust: macros: enable use of hyphens in module names



Jeu 30 janv 2025, à 05:58, Viresh Kumar a écrit :
> On 22-01-25, 14:39, Anisse Astier wrote:
>> +    /* Rust does not allow hyphens in identifiers, use underscore instead */
>> +    let name_identifier = info.name.replace("-", "_");
>
> With CLIPPY=1 W=1, this gives:
>
> warning: single-character string constant used as pattern
>    --> /mnt/ssd/all/work/repos/kernel/linux/rust/macros/module.rs:186:45
>     |
> 186 |     let name_identifier = info.name.replace("-", "_");
>     |                                             ^^^ help: consider 
> using a `char`: `'-'`
>     |
>     = help: for further information visit 
> https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
>     = note: `-W clippy::single-char-pattern` implied by `-W clippy::all`
>     = help: to override `-W clippy::all` add 
> `#[allow(clippy::single_char_pattern)]`
>
> warning: 1 warning emitted
>
> This fixes it:
>
> diff --git a/rust/macros/module.rs b/rust/macros/module.rs
> index 1eff30d2ca6a..2e740bbdb598 100644
> --- a/rust/macros/module.rs
> +++ b/rust/macros/module.rs
> @@ -183,7 +183,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
>      let info = ModuleInfo::parse(&mut it);
>
>      /* Rust does not allow hyphens in identifiers, use underscore instead */
> -    let name_identifier = info.name.replace("-", "_");
> +    let name_identifier = info.name.replace('-', "_");
>      let mut modinfo = ModInfoBuilder::new(name_identifier.as_ref());
>      if let Some(author) = info.author {
>          modinfo.emit("author", &author);
>
>
> Will include it in my V8 now, unless you have any objections to it.

No objections and nice catch!

Regards,

Anisse 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ