Skip to content

Commit 4bf116e

Browse files
committed
style: format code and adjust indentation
Signed-off-by: Longbing Zheng <1211998648@qq.com>
1 parent 3853475 commit 4bf116e

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

allwinner-rt/src/macros.rs

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
macro_rules! soc {
2-
($($(#[$doc:meta])* pub struct $Ty: ident => $paddr: expr_2021$(, $DerefTy: ty)+;)+) => {
2+
(
33
$(
4-
$(#[$doc])*
5-
#[allow(non_camel_case_types)]
6-
pub struct $Ty {
7-
_private: (),
8-
}
9-
$(
10-
impl core::ops::Deref for $Ty {
11-
type Target = $DerefTy;
12-
#[inline(always)]
13-
fn deref(&self) -> &Self::Target {
14-
unsafe { &*($paddr as *const _) }
15-
}
16-
}
17-
impl core::convert::AsRef<$DerefTy> for $Ty {
18-
#[inline(always)]
19-
fn as_ref(&self) -> &$DerefTy {
20-
unsafe { &*($paddr as *const _) }
21-
}
22-
}
23-
)+
4+
$(#[$doc:meta])*
5+
pub struct $Ty:ident => $paddr:expr_2021
6+
$(, $DerefTy:ty)+ ;
7+
)+
8+
) => {
9+
$(
10+
$(#[$doc])*
11+
#[allow(non_camel_case_types)]
12+
pub struct $Ty {
13+
_private: (),
14+
}
15+
16+
$(
17+
impl core::ops::Deref for $Ty {
18+
type Target = $DerefTy;
19+
20+
#[inline(always)]
21+
fn deref(&self) -> &Self::Target {
22+
unsafe { &*($paddr as *const _) }
23+
}
24+
}
25+
26+
impl core::convert::AsRef<$DerefTy> for $Ty {
27+
#[inline(always)]
28+
fn as_ref(&self) -> &$DerefTy {
29+
unsafe { &*($paddr as *const _) }
30+
}
31+
}
32+
)+
2433
)+
2534
};
2635
}

0 commit comments

Comments
 (0)