diff options
| author | Andreas Hindborg <a.hindborg@kernel.org> | 2025-09-24 14:39:27 +0200 |
|---|---|---|
| committer | Daniel Gomez <da.gomez@kernel.org> | 2025-11-03 14:41:29 +0100 |
| commit | 3809d7a89fe550bf4065c04adff6dac610daddad (patch) | |
| tree | db4a62937a6d4e65d22dd2a31519e72dbb79a07e | |
| parent | 0b08fc292842a13aa496413b48c1efb83573b8c6 (diff) | |
rust: module: use a reference in macros::module::module
When we add parameter support to the module macro, we want to be able to
pass a reference to `ModuleInfo` to a helper function. That is not possible
when we move out of the local `modinfo`. So change the function to access
the local via reference rather than value.
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Tested-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Daniel Gomez <da.gomez@kernel.org>
| -rw-r--r-- | rust/macros/module.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 5ee54a00c0b6..cbf3ac0a8f7b 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -176,23 +176,23 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { // Rust does not allow hyphens in identifiers, use underscore instead. let ident = info.name.replace('-', "_"); let mut modinfo = ModInfoBuilder::new(ident.as_ref()); - if let Some(authors) = info.authors { + if let Some(authors) = &info.authors { for author in authors { - modinfo.emit("author", &author); + modinfo.emit("author", author); } } - if let Some(description) = info.description { - modinfo.emit("description", &description); + if let Some(description) = &info.description { + modinfo.emit("description", description); } modinfo.emit("license", &info.license); - if let Some(aliases) = info.alias { + if let Some(aliases) = &info.alias { for alias in aliases { - modinfo.emit("alias", &alias); + modinfo.emit("alias", alias); } } - if let Some(firmware) = info.firmware { + if let Some(firmware) = &info.firmware { for fw in firmware { - modinfo.emit("firmware", &fw); + modinfo.emit("firmware", fw); } } |
