Skip to content

Enable rustfmt formatting of code in doc comments #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
edition = "2018"
format_code_in_doc_comments = true
7 changes: 3 additions & 4 deletions rust/kernel/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn panic(_info: &PanicInfo) -> ! {
/// // This prints `8`.
/// println!("{}", offset_of!(Test, b));
/// }
///```
/// ```
#[macro_export]
macro_rules! offset_of {
($type:ty, $($f:tt)*) => {{
Expand Down Expand Up @@ -189,14 +189,13 @@ macro_rules! offset_of {
/// }
///
/// fn test() {
/// let test = Test{a: 10, b: 20};
/// let test = Test { a: 10, b: 20 };
/// let b_ptr = &test.b;
/// let test_alias = unsafe { container_of!(b_ptr, Test, b) };
/// // This prints `true`.
/// println!("{}", core::ptr::eq(&test, test_alias));
/// }
///```
///
/// ```
#[macro_export]
macro_rules! container_of {
($ptr:expr, $type:ty, $($f:tt)*) => {{
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/module_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ macro_rules! impl_module_param {
/// make_param_ops!(
/// /// Documentation for new param ops.
/// PARAM_OPS_MYTYPE, // Name for the static.
/// MyType // A type which implements [`ModuleParam`].
/// MyType // A type which implements [`ModuleParam`].
/// );
/// ```
macro_rules! make_param_ops {
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/static_assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/// static_assert!(X[1] == 'a' as u8);
///
/// const fn f(x: i32) -> i32 {
/// x + 2
/// x + 2
/// }
/// static_assert!(f(40) == 42);
/// ```
Expand Down
2 changes: 1 addition & 1 deletion rust/kernel/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//!```
//! fn test() {
//! // SAFETY: `init` is called below.
//! let data = alloc::sync::Arc::pin(unsafe{ Mutex::new(0) });
//! let data = alloc::sync::Arc::pin(unsafe { Mutex::new(0) });
//! mutex_init!(data.as_ref(), "test::data");
//! *data.lock() = 10;
//! kernel::println!("{}", *data.lock());
Expand Down