Skip to content

Commit 9cba3f1

Browse files
committed
Apply rustfmt to some crates
1 parent 754619f commit 9cba3f1

File tree

5 files changed

+41
-27
lines changed

5 files changed

+41
-27
lines changed

arduino-hal/src/simple_pwm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ pub use avr_hal_generic::simple_pwm::Prescaler;
1212
pub use atmega_hal::simple_pwm::*;
1313

1414
#[cfg(feature = "mcu-attiny")]
15-
pub use attiny_hal::simple_pwm::*;
15+
pub use attiny_hal::simple_pwm::*;

avr-hal-generic/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@
44

55
pub extern crate embedded_hal as hal;
66

7+
#[doc(hidden)]
8+
pub extern crate avr_device;
79
#[doc(hidden)]
810
pub extern crate nb;
911
#[doc(hidden)]
10-
pub extern crate void;
12+
pub extern crate paste;
1113
#[doc(hidden)]
1214
pub extern crate ufmt;
1315
#[doc(hidden)]
14-
pub extern crate paste;
15-
#[doc(hidden)]
16-
pub extern crate avr_device;
16+
pub extern crate void;
1717

18+
pub mod adc;
1819
pub mod clock;
1920
pub mod delay;
20-
pub mod port;
21-
pub mod usart;
2221
pub mod i2c;
23-
pub mod spi;
24-
pub mod adc;
22+
pub mod port;
2523
pub mod simple_pwm;
24+
pub mod spi;
25+
pub mod usart;
2626
pub mod wdt;
2727

2828
/// Prelude containing all HAL traits
2929
pub mod prelude {
30-
pub use hal::prelude::*;
31-
pub use hal::digital::v2::OutputPin as _;
3230
pub use hal::digital::v2::InputPin as _;
31+
pub use hal::digital::v2::OutputPin as _;
3332
pub use hal::digital::v2::StatefulOutputPin as _;
3433
pub use hal::digital::v2::ToggleableOutputPin as _;
35-
pub use void::ResultVoidExt as _;
36-
pub use void::ResultVoidErrExt as _;
34+
pub use hal::prelude::*;
3735
pub use ufmt::uWrite as _;
36+
pub use void::ResultVoidErrExt as _;
37+
pub use void::ResultVoidExt as _;
3838
}
3939

4040
// For making certain traits unimplementable from outside this crate.

avr-hal-generic/src/port.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod mode {
2525
impl crate::Sealed for OpenDrain {}
2626

2727
pub struct PwmOutput<TC> {
28-
pub(crate) _timer: PhantomData<TC>
28+
pub(crate) _timer: PhantomData<TC>,
2929
}
3030
impl<TC> super::PinMode for PwmOutput<TC> {}
3131
impl<TC> crate::Sealed for PwmOutput<TC> {}

avr-hal-generic/src/simple_pwm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
use core::marker::PhantomData;
44

5-
use crate::port::Pin;
65
use crate::port::mode;
6+
use crate::port::Pin;
77

88
/// Clock prescaler for PWM
99
///
@@ -55,7 +55,7 @@ impl<TC, PIN: PwmPinOps<TC>> IntoPwmPin<TC, PIN> for Pin<mode::Output, PIN> {
5555
fn into_pwm(self, _timer: &TC) -> Pin<mode::PwmOutput<TC>, PIN> {
5656
Pin {
5757
pin: self.pin,
58-
_mode: PhantomData
58+
_mode: PhantomData,
5959
}
6060
}
6161
}
@@ -157,4 +157,4 @@ macro_rules! impl_simple_pwm {
157157
}
158158
)+
159159
}
160-
}
160+
}

mcu/atmega-hal/src/simple_pwm.rs

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ use avr_hal_generic::simple_pwm::Prescaler;
22

33
use crate::port::*;
44

5-
#[cfg(any(feature = "atmega48p", feature = "atmega168", feature = "atmega328p", feature = "atmega328pb"))]
5+
#[cfg(any(
6+
feature = "atmega48p",
7+
feature = "atmega168",
8+
feature = "atmega328p",
9+
feature = "atmega328pb"
10+
))]
611
avr_hal_generic::impl_simple_pwm! {
712
/// Use `TC0` for PWM (pins `PD5`, `PD6`)
813
///
@@ -50,7 +55,12 @@ avr_hal_generic::impl_simple_pwm! {
5055
}
5156
}
5257

53-
#[cfg(any(feature = "atmega48p", feature = "atmega168", feature = "atmega328p", feature = "atmega328pb"))]
58+
#[cfg(any(
59+
feature = "atmega48p",
60+
feature = "atmega168",
61+
feature = "atmega328p",
62+
feature = "atmega328pb"
63+
))]
5464
avr_hal_generic::impl_simple_pwm! {
5565
/// Use `TC1` for PWM (pins `PB1`, `PB2`)
5666
///
@@ -102,7 +112,12 @@ avr_hal_generic::impl_simple_pwm! {
102112
}
103113
}
104114

105-
#[cfg(any(feature = "atmega48p", feature = "atmega168", feature = "atmega328p", feature = "atmega328pb"))]
115+
#[cfg(any(
116+
feature = "atmega48p",
117+
feature = "atmega168",
118+
feature = "atmega328p",
119+
feature = "atmega328pb"
120+
))]
106121
avr_hal_generic::impl_simple_pwm! {
107122
/// Use `TC2` for PWM (pins `PB3`, `PD3`)
108123
///
@@ -232,8 +247,7 @@ avr_hal_generic::impl_simple_pwm! {
232247
}
233248
}
234249

235-
236-
#[cfg(any(feature = "atmega1280", feature="atmega2560"))]
250+
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
237251
avr_hal_generic::impl_simple_pwm! {
238252
/// Use `TC0` for PWM (pins `PB7`, `PG5`)
239253
///
@@ -281,7 +295,7 @@ avr_hal_generic::impl_simple_pwm! {
281295
}
282296
}
283297

284-
#[cfg(any(feature = "atmega1280", feature="atmega2560"))]
298+
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
285299
avr_hal_generic::impl_simple_pwm! {
286300
/// Use `TC1` for PWM (pins `PB5`, `PB6`, `PB7`)
287301
///
@@ -339,7 +353,7 @@ avr_hal_generic::impl_simple_pwm! {
339353
}
340354
}
341355

342-
#[cfg(any(feature = "atmega1280", feature="atmega2560"))]
356+
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
343357
avr_hal_generic::impl_simple_pwm! {
344358
/// Use `TC2` for PWM (pins `PB4`, `PH6`)
345359
///
@@ -392,7 +406,7 @@ avr_hal_generic::impl_simple_pwm! {
392406
}
393407
}
394408

395-
#[cfg(any(feature = "atmega1280", feature="atmega2560"))]
409+
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
396410
avr_hal_generic::impl_simple_pwm! {
397411
/// Use `TC3` for PWM (pins `PE3`, `PE4`, `PE5`)
398412
///
@@ -455,7 +469,7 @@ avr_hal_generic::impl_simple_pwm! {
455469
}
456470
}
457471

458-
#[cfg(any(feature = "atmega1280", feature="atmega2560"))]
472+
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
459473
avr_hal_generic::impl_simple_pwm! {
460474
/// Use `TC4` for PWM (pins `PH3`, `PH4`, `PH5`)
461475
///
@@ -518,7 +532,7 @@ avr_hal_generic::impl_simple_pwm! {
518532
}
519533
}
520534

521-
#[cfg(any(feature = "atmega1280", feature="atmega2560"))]
535+
#[cfg(any(feature = "atmega1280", feature = "atmega2560"))]
522536
avr_hal_generic::impl_simple_pwm! {
523537
/// Use `TC5` for PWM (pins `PL3`, `PL4`, `PL5`)
524538
///

0 commit comments

Comments
 (0)