rust: use vertical import style in miscdevice
Subsystems (2)
cover rust: use vertical import style in miscdevice
Reformat use imports to vertical style for readability and to reduce merge conflicts when imports are added or removed.
---
Alvin Sun (2):
rust: miscdevice: use vertical import style
samples: rust_misc_device: use vertical import style
rust/kernel/miscdevice.rs | 34 ++++++++++++++++++++++++++++------ samples/rust/rust_misc_device.rs | 34 ++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 12 deletions(-)
---
base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
change-id: 20260519-miscdev-use-format-9ab7e83b1c11
Best regards,
Signature · 1 line
Alvin Sun <[email protected]>
PATCH 1/2 rust: miscdevice: use vertical import style
Convert use imports to vertical layout for better readability and maintainability.
--- rust/kernel/miscdevice.rs | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
rust/kernel/miscdevice.rs +28 -6
@@ -11,16 +11,38 @@use crate ::{ bindings, device::Device , - error::{to_result,Error ,Result ,VTABLE_DEFAULT_ERROR }, - ffi::{c_int, c_long, c_uint, c_ulong}, - fs::{File ,Kiocb }, - iov::{IovIterDest ,IovIterSource }, + error::{ + to_result, +Error , +Result , +VTABLE_DEFAULT_ERROR ,// + }, + ffi::{ + c_int, + c_long, + c_uint, + c_ulong,// + }, + fs::{ +File , +Kiocb ,// + }, + iov::{ +IovIterDest , +IovIterSource ,// + }, mm::virt::VmaNew , prelude::*, seq_file::SeqFile , - types::{ForeignOwnable ,Opaque }, + types::{ +ForeignOwnable , +Opaque ,// + }, +}; +use core::{ + marker::PhantomData , + pin::Pin ,// }; -use core::{marker::PhantomData , pin::Pin };/// Options for creating a misc device. #[derive( Copy , Clone )]
Signature · 1 line
2.43.0
Re: [PATCH 1/2] rust: miscdevice: use vertical import style
Quoted 3 lines · Alvin Sun
Convert
useimports to vertical layout for better readability and maintainability.
A bunch of these are already available through the prelude, so I would suggest taking the chance to clean those up too, possibly in a separate commit.
Thanks!
Cheers,
Miguel
Re: [PATCH 1/2] rust: miscdevice: use vertical import style
Quoted 6 lines · Miguel Ojeda
Quoted 2 lines · Alvin Sun
Convert
useimports to vertical layout for better readability and maintainability.A bunch of these are already available through the prelude, so I would suggest taking the chance to clean those up too, possibly in a separate commit.
I'm working on it.
Best regards,
Alvin
Quoted 5 lines
Thanks!
Cheers,
Miguel
PATCH 2/2 samples: rust_misc_device: use vertical import style
In reply to Alvin SunConvert use imports to vertical layout for better readability and maintainability.
--- samples/rust/rust_misc_device.rs | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
samples/rust/rust_misc_device.rs +28 -6
@@ -97,14 +97,36 @@use kernel::{ device::Device , - fs::{File ,Kiocb }, - ioctl::{_IO, _IOC_SIZE, _IOR, _IOW}, - iov::{IovIterDest ,IovIterSource }, - miscdevice::{MiscDevice ,MiscDeviceOptions ,MiscDeviceRegistration }, + fs::{ +File , +Kiocb ,// + }, + ioctl::{ + _IO, + _IOC_SIZE, + _IOR, + _IOW,// + }, + iov::{ +IovIterDest , +IovIterSource ,// + }, + miscdevice::{ +MiscDevice , +MiscDeviceOptions , +MiscDeviceRegistration ,// + }, new_mutex, prelude::*, - sync::{aref::ARef ,Mutex }, - uaccess::{UserSlice ,UserSliceReader ,UserSliceWriter }, + sync::{ + aref::ARef , +Mutex ,// + }, + uaccess::{ +UserSlice , +UserSliceReader , +UserSliceWriter ,// + }, };const RUST_MISC_DEV_HELLO :u32 =_IO ('|' as u32 ,0x80 );
Signature · 1 line
2.43.0