Skip to content

Commit 3f82f55

Browse files
Andreas Hindborgjannau
authored andcommitted
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>
1 parent 82590b2 commit 3f82f55

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

rust/macros/module.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,23 +176,23 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
176176
// Rust does not allow hyphens in identifiers, use underscore instead.
177177
let ident = info.name.replace('-', "_");
178178
let mut modinfo = ModInfoBuilder::new(ident.as_ref());
179-
if let Some(authors) = info.authors {
179+
if let Some(authors) = &info.authors {
180180
for author in authors {
181-
modinfo.emit("author", &author);
181+
modinfo.emit("author", author);
182182
}
183183
}
184-
if let Some(description) = info.description {
185-
modinfo.emit("description", &description);
184+
if let Some(description) = &info.description {
185+
modinfo.emit("description", description);
186186
}
187187
modinfo.emit("license", &info.license);
188-
if let Some(aliases) = info.alias {
188+
if let Some(aliases) = &info.alias {
189189
for alias in aliases {
190-
modinfo.emit("alias", &alias);
190+
modinfo.emit("alias", alias);
191191
}
192192
}
193-
if let Some(firmware) = info.firmware {
193+
if let Some(firmware) = &info.firmware {
194194
for fw in firmware {
195-
modinfo.emit("firmware", &fw);
195+
modinfo.emit("firmware", fw);
196196
}
197197
}
198198

0 commit comments

Comments
 (0)