Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andreas Hindborg and committed by
Daniel Gomez
3809d7a8 0b08fc29

+8 -8
+8 -8
rust/macros/module.rs
··· 176 176 // Rust does not allow hyphens in identifiers, use underscore instead. 177 177 let ident = info.name.replace('-', "_"); 178 178 let mut modinfo = ModInfoBuilder::new(ident.as_ref()); 179 - if let Some(authors) = info.authors { 179 + if let Some(authors) = &info.authors { 180 180 for author in authors { 181 - modinfo.emit("author", &author); 181 + modinfo.emit("author", author); 182 182 } 183 183 } 184 - if let Some(description) = info.description { 185 - modinfo.emit("description", &description); 184 + if let Some(description) = &info.description { 185 + modinfo.emit("description", description); 186 186 } 187 187 modinfo.emit("license", &info.license); 188 - if let Some(aliases) = info.alias { 188 + if let Some(aliases) = &info.alias { 189 189 for alias in aliases { 190 - modinfo.emit("alias", &alias); 190 + modinfo.emit("alias", alias); 191 191 } 192 192 } 193 - if let Some(firmware) = info.firmware { 193 + if let Some(firmware) = &info.firmware { 194 194 for fw in firmware { 195 - modinfo.emit("firmware", &fw); 195 + modinfo.emit("firmware", fw); 196 196 } 197 197 } 198 198