Skip to content

Commit 7a2f905

Browse files
committed
Run cargo format
1 parent 511ebcd commit 7a2f905

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

riscv-rt/build.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,25 @@ fn parse_target(target: &str, cargo_flags: &str) -> (u32, HashSet<char>) {
4646
let cargo_flags = cargo_flags
4747
.split(0x1fu8 as char)
4848
.filter(|arg| !arg.is_empty());
49-
49+
5050
cargo_flags
51-
.filter(|k| k.starts_with("target-feature=")).flat_map(|str| {
51+
.filter(|k| k.starts_with("target-feature="))
52+
.flat_map(|str| {
5253
let flags = str.split('=').collect::<Vec<&str>>()[1];
5354
flags.split(',')
5455
})
5556
.for_each(|feature| {
5657
let chars = feature.chars().collect::<Vec<char>>();
5758
match chars[0] {
58-
'+' => { extensions.insert(chars[1]); }
59-
'-' => { extensions.remove(&chars[1]); }
60-
_ => { panic!("Unsupported target feature operation"); }
59+
'+' => {
60+
extensions.insert(chars[1]);
61+
}
62+
'-' => {
63+
extensions.remove(&chars[1]);
64+
}
65+
_ => {
66+
panic!("Unsupported target feature operation");
67+
}
6168
}
6269
});
6370

@@ -73,7 +80,7 @@ fn main() {
7380
if target.starts_with("riscv") {
7481
println!("cargo:rustc-cfg=riscv");
7582

76-
// This is required until target_arch & target_feature risc-v work is
83+
// This is required until target_arch & target_feature risc-v work is
7784
// stable and in-use (rust 1.75.0)
7885
let (bits, extensions) = parse_target(&target, &cargo_flags);
7986

riscv-rt/macros/src/lib.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ extern crate proc_macro2;
99
extern crate syn;
1010

1111
use proc_macro2::Span;
12-
use syn::{parse::{self, Parse}, spanned::Spanned, FnArg, ItemFn, PathArguments, ReturnType, Type, Visibility, LitStr, LitInt};
12+
use syn::{
13+
parse::{self, Parse},
14+
spanned::Spanned,
15+
FnArg, ItemFn, LitInt, LitStr, PathArguments, ReturnType, Type, Visibility,
16+
};
1317

1418
use proc_macro::TokenStream;
1519

@@ -230,9 +234,9 @@ impl Parse for AsmLoopArgs {
230234
/// See [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)
231235
/// for details.
232236
///
233-
/// Argument 1 is an assembly expression, all "{}" in this assembly expression will be replaced with the
237+
/// Argument 1 is an assembly expression, all "{}" in this assembly expression will be replaced with the
234238
/// current loop index.
235-
///
239+
///
236240
/// Argument 2 is the number of loops to do with the provided expression.
237241
///
238242
/// # Examples
@@ -247,10 +251,13 @@ impl Parse for AsmLoopArgs {
247251
pub fn loop_asm(input: TokenStream) -> TokenStream {
248252
let args = parse_macro_input!(input as AsmLoopArgs);
249253

250-
let tokens = (0..args.count).map(|i| {
251-
let i = i.to_string();
252-
let asm = args.asm_template.replace("{}", &i);
253-
format!("core::arch::asm!(\"{}\");", asm)
254-
}).collect::<Vec<String>>().join("\n");
254+
let tokens = (0..args.count)
255+
.map(|i| {
256+
let i = i.to_string();
257+
let asm = args.asm_template.replace("{}", &i);
258+
format!("core::arch::asm!(\"{}\");", asm)
259+
})
260+
.collect::<Vec<String>>()
261+
.join("\n");
255262
tokens.parse().unwrap()
256263
}

riscv-rt/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ pub unsafe extern "C" fn start_rust(a0: usize, a1: usize, a2: usize) -> ! {
525525

526526
// Zero out floating point registers
527527
if cfg!(all(target_arch = "riscv32", riscvd)) {
528-
// rv32 targets with double precision floating point can use fmvp.d.x
529-
// to combine 2 32 bit registers to fill the 64 bit floating point
528+
// rv32 targets with double precision floating point can use fmvp.d.x
529+
// to combine 2 32 bit registers to fill the 64 bit floating point
530530
// register
531531
riscv_rt_macros::loop_asm!("fmvp.d.x f{}, x0, x0", 32);
532532
} else if cfg!(riscvd) {

0 commit comments

Comments
 (0)