Skip to content

Commit ea92699

Browse files
committed
Reformat with use_small_heuristics = "Max"
1 parent 2676ed2 commit ea92699

File tree

6 files changed

+14
-50
lines changed

6 files changed

+14
-50
lines changed

rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ format_strings = true
55
merge_imports = true
66
newline_style = "Unix"
77
overflow_delimited_expr = true
8+
reorder_impl_items = true
89
unstable_features = true
910
use_field_init_shorthand = true
11+
use_small_heuristics = "Max"
1012
version = "Two"

src/periph/gpio/head.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,7 @@ map_gpio_port_head! {
238238
IOPESMEN,
239239
}
240240

241-
#[cfg(any(
242-
stm32_mcu = "stm32f100",
243-
stm32_mcu = "stm32f101",
244-
stm32_mcu = "stm32f103"
245-
))]
241+
#[cfg(any(stm32_mcu = "stm32f100", stm32_mcu = "stm32f101", stm32_mcu = "stm32f103"))]
246242
map_gpio_port_head! {
247243
"Extracts GPIO port F head register tokens.",
248244
periph_gpio_f_head,
@@ -257,11 +253,7 @@ map_gpio_port_head! {
257253
IOPFSMEN,
258254
}
259255

260-
#[cfg(any(
261-
stm32_mcu = "stm32f100",
262-
stm32_mcu = "stm32f101",
263-
stm32_mcu = "stm32f103"
264-
))]
256+
#[cfg(any(stm32_mcu = "stm32f100", stm32_mcu = "stm32f101", stm32_mcu = "stm32f103"))]
265257
map_gpio_port_head! {
266258
"Extracts GPIO port G head register tokens.",
267259
periph_gpio_g_head,

src/periph/gpio/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,11 +1134,7 @@ map_gpio_port! {
11341134
(),
11351135
}
11361136

1137-
#[cfg(any(
1138-
stm32_mcu = "stm32f100",
1139-
stm32_mcu = "stm32f101",
1140-
stm32_mcu = "stm32f103"
1141-
))]
1137+
#[cfg(any(stm32_mcu = "stm32f100", stm32_mcu = "stm32f101", stm32_mcu = "stm32f103"))]
11421138
map_gpio_port! {
11431139
"Extracts GPIO port F register tokens.",
11441140
periph_gpio_f,
@@ -1154,11 +1150,7 @@ map_gpio_port! {
11541150
(),
11551151
}
11561152

1157-
#[cfg(any(
1158-
stm32_mcu = "stm32f100",
1159-
stm32_mcu = "stm32f101",
1160-
stm32_mcu = "stm32f103"
1161-
))]
1153+
#[cfg(any(stm32_mcu = "stm32f100", stm32_mcu = "stm32f101", stm32_mcu = "stm32f103"))]
11621154
map_gpio_port! {
11631155
"Extracts GPIO port G register tokens.",
11641156
periph_gpio_g,

svd/src/adc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ pub fn fix_adc1_1(dev: &mut Device) -> Result<()> {
2828
pub fn fix_adc_1(dev: &mut Device) -> Result<()> {
2929
dev.periph("ADC").reg("SMPR1").remove_field("SMPPLUS");
3030
for i in 1..=4 {
31-
dev.periph("ADC")
32-
.reg(&format!("JDR{}", i))
33-
.field(&format!("JDATA{}", i))
34-
.name = "JDATA".to_string();
31+
dev.periph("ADC").reg(&format!("JDR{}", i)).field(&format!("JDATA{}", i)).name =
32+
"JDATA".to_string();
3533
}
3634
Ok(())
3735
}

svd/src/lib.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,7 @@ pub use anyhow::{bail, Result};
2323
use drone_svd::Device;
2424
use std::{env, fs::File, path::Path};
2525

26-
const REG_EXCLUDE: &[&str] = &[
27-
"FPU",
28-
"FPU_CPACR",
29-
"ITM",
30-
"MPU",
31-
"NVIC",
32-
"SCB",
33-
"STK",
34-
"TPIU",
35-
];
26+
const REG_EXCLUDE: &[&str] = &["FPU", "FPU_CPACR", "ITM", "MPU", "NVIC", "SCB", "STK", "TPIU"];
3627

3728
/// Generates code for register mappings.
3829
pub fn generate_regs(pool_number: usize, pool_size: usize) -> Result<()> {
@@ -50,12 +41,7 @@ pub fn generate_rest() -> Result<()> {
5041
let dev = svd_deserialize()?;
5142
let mut reg_tokens = File::create(out_dir.join("svd_reg_index.rs"))?;
5243
let mut interrupts = File::create(out_dir.join("svd_interrupts.rs"))?;
53-
dev.generate_rest(
54-
&mut reg_tokens,
55-
&mut interrupts,
56-
REG_EXCLUDE,
57-
"stm32_reg_tokens",
58-
)
44+
dev.generate_rest(&mut reg_tokens, &mut interrupts, REG_EXCLUDE, "stm32_reg_tokens")
5945
}
6046

6147
fn svd_deserialize() -> Result<Device> {
@@ -422,11 +408,7 @@ fn copy_field(
422408
reg_name: &str,
423409
field_name: &str,
424410
) {
425-
let field = dev
426-
.periph(periph_from)
427-
.reg(reg_name)
428-
.field(field_name)
429-
.clone();
411+
let field = dev.periph(periph_from).reg(reg_name).field(field_name).clone();
430412
dev.periph(periph_to).reg(reg_name).add_field(field);
431413
}
432414

svd/src/rcc.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ pub fn fix_2(dev: &mut Device) -> Result<()> {
5757
}
5858

5959
pub fn fix_3(dev: &mut Device) -> Result<()> {
60-
for (reg_name, field_name) in &[
61-
("AHB1ENR", "GPIOIEN"),
62-
("AHB1RSTR", "GPIOIRST"),
63-
("AHB1LPENR", "GPIOILPEN"),
64-
] {
60+
for (reg_name, field_name) in
61+
&[("AHB1ENR", "GPIOIEN"), ("AHB1RSTR", "GPIOIRST"), ("AHB1LPENR", "GPIOILPEN")]
62+
{
6563
for (name, description, offset) in &[("GPIOJ", "port J", 1), ("GPIOK", "port K", 2)] {
6664
let mut field = dev.periph("RCC").reg(reg_name).field(field_name).clone();
6765
field.name = field.name.replace("GPIOI", name);

0 commit comments

Comments
 (0)