]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: pin-init: internal: remove redundant `#[pin]` filtering
authorGary Guo <gary@garyguo.net>
Tue, 28 Apr 2026 13:10:55 +0000 (14:10 +0100)
committerGary Guo <gary@garyguo.net>
Sun, 10 May 2026 21:58:34 +0000 (22:58 +0100)
The `generate_projections` and `generate_the_pin_data` function already
receive filtered field lists, they do not need to filter out `#[pin]`
again.

Reviewed-by: Benno Lossin <lossin@kernel.org>
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-6-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo <gary@garyguo.net>
rust/pin-init/internal/src/pin_data.rs

index 6b1b8f26379acf88c48f51117db87722084fa933..76cd11bf28ebbf8d560243b400bc9cf2f84ba831 100644 (file)
@@ -258,8 +258,6 @@ fn generate_projections(
                 ..
             },
         )| {
-            let mut attrs = attrs.clone();
-            attrs.retain(|a| !a.path().is_ident("pin"));
             let mut no_doc_attrs = attrs.clone();
             no_doc_attrs.retain(|a| !a.path().is_ident("doc"));
             let ident = ident
@@ -360,8 +358,6 @@ fn generate_the_pin_data(
         struct_ident: &Ident,
         pinned: bool,
     ) -> TokenStream {
-        let mut attrs = attrs.clone();
-        attrs.retain(|a| !a.path().is_ident("pin"));
         let ident = ident
             .as_ref()
             .expect("only structs with named fields are supported");