Skip to content

Commit 3100520

Browse files
committed
rust: pin-init: internal: skip rustfmt formatting of kernel-only module
The `quote` module only is available in the kernel and thus running `cargo fmt` or `rustfmt internal/src/lib.rs` in the user-space repository [1] results in: error: couldn't read `~/pin-init/internal/src/../../../macros/quote.rs`: No such file or directory (os error 2) --> ~/pin-init/internal/src/lib.rs:25:1 | 25 | mod quote; | ^^^^^^^^^^ Error writing files: failed to resolve mod `quote`: ~/pin-init/internal/src/../../../macros/quote.rs does not exist Thus mark it with `rustfmt::skip` when compiling without kernel support. Link: https://github.com/Rust-for-Linux/pin-init [1] Link: Rust-for-Linux/pin-init@a6caf19 Link: https://lore.kernel.org/all/[email protected] Reviewed-by: Christian Schrefl <[email protected]> Signed-off-by: Benno Lossin <[email protected]>
1 parent 2cce50f commit 3100520

File tree

1 file changed

+1
-0
lines changed
  • rust/pin-init/internal/src

1 file changed

+1
-0
lines changed

rust/pin-init/internal/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use proc_macro::TokenStream;
2222
#[cfg(kernel)]
2323
#[path = "../../../macros/quote.rs"]
2424
#[macro_use]
25+
#[cfg_attr(not(kernel), rustfmt::skip)]
2526
mod quote;
2627
#[cfg(not(kernel))]
2728
#[macro_use]

0 commit comments

Comments
 (0)