Skip to content

Commit d8647ea

Browse files
authored
Merge pull request #164 from ojeda/rustfmt
`rustfmt` cleanups
2 parents 47c4329 + 3a62fdc commit d8647ea

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

.rustfmt.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
edition = "2018"
22
format_code_in_doc_comments = true
3+
newline_style = "Unix"
4+
5+
# Unstable options that help catching some mistakes in formatting and that we may want to enable
6+
# when they become stable.
7+
#
8+
# They are kept here since they are useful to run from time to time.
9+
#reorder_impl_items = true
10+
#comment_width = 100
11+
#wrap_comments = true
12+
#normalize_comments = true

rust/kernel/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn panic(_info: &PanicInfo) -> ! {
144144
///
145145
/// # Example
146146
///
147-
///```
147+
/// ```
148148
/// struct Test {
149149
/// a: u64,
150150
/// b: u32,
@@ -182,7 +182,7 @@ macro_rules! offset_of {
182182
///
183183
/// # Example
184184
///
185-
///```
185+
/// ```
186186
/// struct Test {
187187
/// a: u64,
188188
/// b: u32,

rust/kernel/module_param.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ macro_rules! impl_parse_int {
165165
fn from_str_radix(src: &str, radix: u32) -> Result<Self, core::num::ParseIntError> {
166166
$ty::from_str_radix(src, radix)
167167
}
168+
168169
fn checked_neg(self) -> Option<Self> {
169170
self.checked_neg()
170171
}
@@ -187,6 +188,7 @@ macro_rules! impl_module_param {
187188
($ty:ident) => {
188189
impl ModuleParam for $ty {
189190
type Value = $ty;
191+
190192
const NOARG_ALLOWED: bool = false;
191193

192194
fn try_from_param_arg(arg: Option<&'static [u8]>) -> Option<Self> {
@@ -314,6 +316,7 @@ make_param_ops!(
314316

315317
impl ModuleParam for bool {
316318
type Value = bool;
319+
317320
const NOARG_ALLOWED: bool = true;
318321

319322
fn try_from_param_arg(arg: Option<&'static [u8]>) -> Option<Self> {
@@ -403,6 +406,7 @@ impl<T: Copy + core::fmt::Display + ModuleParam, const N: usize> ModuleParam
403406
for ArrayParam<T, { N }>
404407
{
405408
type Value = [T];
409+
406410
const NOARG_ALLOWED: bool = false;
407411

408412
fn try_from_param_arg(arg: Option<&'static [u8]>) -> Option<Self> {
@@ -462,6 +466,7 @@ impl core::fmt::Display for StringParam {
462466

463467
impl ModuleParam for StringParam {
464468
type Value = [u8];
469+
465470
const NOARG_ALLOWED: bool = false;
466471

467472
fn try_from_param_arg(arg: Option<&'static [u8]>) -> Option<Self> {

rust/kernel/sync/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! # Example
99
//!
10-
//!```
10+
//! ```
1111
//! fn test() {
1212
//! // SAFETY: `init` is called below.
1313
//! let data = alloc::sync::Arc::pin(unsafe { Mutex::new(0) });

rust/module.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,9 @@ fn generated_array_ops_name(vals: &str, max_length: usize) -> String {
375375
/// - `u64`: Corresponds to C `ullong` param type.
376376
/// - `isize`: No equivalent C param type.
377377
/// - `usize`: No equivalent C param type.
378-
/// - `str`: Corresponds to C `charp` param type. Reading returns a byte
379-
/// slice.
380-
/// - `ArrayParam<T,N>`: Corresponds to C parameters created using
381-
/// `module_param_array`. An array of `T`'s of length at **most** `N`.
378+
/// - `str`: Corresponds to C `charp` param type. Reading returns a byte slice.
379+
/// - `ArrayParam<T,N>`: Corresponds to C parameters created using `module_param_array`. An array
380+
/// of `T`'s of length at **most** `N`.
382381
///
383382
/// `invbool` is unsupported: it was only ever used in a few modules.
384383
/// Consider using a `bool` and inverting the logic instead.

0 commit comments

Comments
 (0)