Skip to content

Commit 184d511

Browse files
committed
fix cargo fmt
1 parent 16644b6 commit 184d511

18 files changed

+64
-70
lines changed

build.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ fn main() {
1313
let mut target = Target::from_target_str(&target);
1414
target.retain_extensions("ic");
1515

16-
let target = target.to_string();
16+
let target = target.to_string();
1717

1818
fs::copy(
1919
format!("bin/{}.a", target),
2020
out_dir.join(format!("lib{}.a", name)),
21-
).unwrap();
21+
)
22+
.unwrap();
2223

2324
println!("cargo:rustc-link-lib=static={}", name);
2425
println!("cargo:rustc-link-search={}", out_dir.display());

src/asm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ macro_rules! instruction {
2525
)
2626
}
2727

28-
2928
instruction!(
3029
/// `EBREAK` instruction wrapper
3130
///
@@ -47,7 +46,6 @@ instruction!(
4746
/// `SFENCE.VMA` are ordered before all implicit references subsequent to the `SFENCE.VMA`.
4847
, sfence_vma_all, "sfence.vma", __sfence_vma_all);
4948

50-
5149
/// `SFENCE.VMA` instruction wrapper
5250
///
5351
/// Synchronizes updates to in-memory memory-management data structures with current execution.

src/interrupt.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@ where
4040
let mstatus = mstatus::read();
4141

4242
// disable interrupts
43-
unsafe { disable(); }
43+
unsafe {
44+
disable();
45+
}
4446

4547
let r = f(unsafe { &CriticalSection::new() });
4648

4749
// If the interrupts were active before our `disable` call, then re-enable
4850
// them. Otherwise, keep them disabled
4951
if mstatus.mie() {
50-
unsafe { enable(); }
52+
unsafe {
53+
enable();
54+
}
5155
}
5256

5357
r

src/register/fcsr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ clear!(0x003, __clear_fcsr);
107107
/// Reads the CSR
108108
#[inline]
109109
pub fn read() -> FCSR {
110-
FCSR { bits: unsafe{ _read() as u32 } }
110+
FCSR {
111+
bits: unsafe { _read() as u32 },
112+
}
111113
}
112114

113115
/// Writes the CSR

src/register/macros.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ macro_rules! read_csr_as {
6363
/// Reads the CSR
6464
#[inline]
6565
pub fn read() -> $register {
66-
$register { bits: unsafe{ _read() } }
66+
$register {
67+
bits: unsafe { _read() },
68+
}
6769
}
6870
};
6971
}
@@ -75,7 +77,7 @@ macro_rules! read_csr_as_usize {
7577
/// Reads the CSR
7678
#[inline]
7779
pub fn read() -> usize {
78-
unsafe{ _read() }
80+
unsafe { _read() }
7981
}
8082
};
8183
}
@@ -87,7 +89,7 @@ macro_rules! read_csr_as_usize_rv32 {
8789
/// Reads the CSR
8890
#[inline]
8991
pub fn read() -> usize {
90-
unsafe{ _read() }
92+
unsafe { _read() }
9193
}
9294
};
9395
}
@@ -151,7 +153,7 @@ macro_rules! write_csr_as_usize {
151153
/// Writes the CSR
152154
#[inline]
153155
pub fn write(bits: usize) {
154-
unsafe{ _write(bits) }
156+
unsafe { _write(bits) }
155157
}
156158
};
157159
}
@@ -163,7 +165,7 @@ macro_rules! write_csr_as_usize_rv32 {
163165
/// Writes the CSR
164166
#[inline]
165167
pub fn write(bits: usize) {
166-
unsafe{ _write(bits) }
168+
unsafe { _write(bits) }
167169
}
168170
};
169171
}
@@ -266,5 +268,5 @@ macro_rules! read_composite_csr {
266268
() => $lo as u64,
267269
}
268270
}
269-
}
271+
};
270272
}

src/register/marchid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ read_csr!(0xF11, __read_marchid);
2020
/// Reads the CSR
2121
#[inline]
2222
pub fn read() -> Option<Marchid> {
23-
let r = unsafe{ _read() };
23+
let r = unsafe { _read() };
2424
// When marchid is hardwired to zero it means that the marchid
2525
// csr isn't implemented.
2626
NonZeroUsize::new(r).map(|bits| Marchid { bits })

src/register/mcause.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ impl Interrupt {
6565
}
6666
}
6767

68-
6968
impl Exception {
7069
pub fn from(nr: usize) -> Self {
7170
match nr {

src/register/mhpmeventx.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ macro_rules! reg {
77
read_csr_as_usize!($addr, $readf);
88
write_csr_as_usize!($addr, $writef);
99
}
10-
}
10+
};
1111
}
1212

13-
reg!(0x323, mhpmevent3, __read_mhpmevent3, __write_mhpmevent3);
14-
reg!(0x324, mhpmevent4, __read_mhpmevent4, __write_mhpmevent4);
15-
reg!(0x325, mhpmevent5, __read_mhpmevent5, __write_mhpmevent5);
16-
reg!(0x326, mhpmevent6, __read_mhpmevent6, __write_mhpmevent6);
17-
reg!(0x327, mhpmevent7, __read_mhpmevent7, __write_mhpmevent7);
18-
reg!(0x328, mhpmevent8, __read_mhpmevent8, __write_mhpmevent8);
19-
reg!(0x329, mhpmevent9, __read_mhpmevent9, __write_mhpmevent9);
13+
reg!(0x323, mhpmevent3, __read_mhpmevent3, __write_mhpmevent3);
14+
reg!(0x324, mhpmevent4, __read_mhpmevent4, __write_mhpmevent4);
15+
reg!(0x325, mhpmevent5, __read_mhpmevent5, __write_mhpmevent5);
16+
reg!(0x326, mhpmevent6, __read_mhpmevent6, __write_mhpmevent6);
17+
reg!(0x327, mhpmevent7, __read_mhpmevent7, __write_mhpmevent7);
18+
reg!(0x328, mhpmevent8, __read_mhpmevent8, __write_mhpmevent8);
19+
reg!(0x329, mhpmevent9, __read_mhpmevent9, __write_mhpmevent9);
2020
reg!(0x32A, mhpmevent10, __read_mhpmevent10, __write_mhpmevent10);
2121
reg!(0x32B, mhpmevent11, __read_mhpmevent11, __write_mhpmevent11);
2222
reg!(0x32C, mhpmevent12, __read_mhpmevent12, __write_mhpmevent12);

src/register/mimpid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ read_csr!(0xF11, __read_mimpid);
2020
/// Reads the CSR
2121
#[inline]
2222
pub fn read() -> Option<Mimpid> {
23-
let r = unsafe{ _read() };
23+
let r = unsafe { _read() };
2424
// When mimpid is hardwired to zero it means that the mimpid
2525
// csr isn't implemented.
2626
NonZeroUsize::new(r).map(|bits| Mimpid { bits })

src/register/misa.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ read_csr!(0x301, __read_misa);
5353
/// Reads the CSR
5454
#[inline]
5555
pub fn read() -> Option<Misa> {
56-
let r = unsafe{ _read() };
56+
let r = unsafe { _read() };
5757
// When misa is hardwired to zero it means that the misa csr
5858
// isn't implemented.
5959
NonZeroUsize::new(r).map(|bits| Misa { bits })

0 commit comments

Comments
 (0)