Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various minor warnings from clippy #41

Merged
merged 1 commit into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions tm4c-hal/src/bb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ use core::ptr::{read_volatile, write_volatile};
use cortex_m::asm::nop;

/// Sets/Clears a bit at the given address atomically, using the bit-banding
/// feature. We take a const pointer and mutate it, but that's because the
/// feature.
///
/// # Safety
///
/// We take a const pointer and mutate it, but that's because the
/// svd2rust crate will only give us const pointers.
pub unsafe fn change_bit<T>(address: *const T, bit: u8, value: bool) {
let address = address as u32;
Expand All @@ -18,7 +22,11 @@ pub unsafe fn change_bit<T>(address: *const T, bit: u8, value: bool) {
}

/// Sets and then Clears a bit at the given address atomically, using the bit-
/// banding feature. We take a const pointer and mutate it, but that's because
/// banding feature.
///
/// # Safety
///
/// We take a const pointer and mutate it, but that's because
/// the svd2rust crate will only give us const pointers.
pub unsafe fn toggle_bit<T>(address: *const T, bit: u8) {
let address = address as u32;
Expand Down
4 changes: 1 addition & 3 deletions tm4c-hal/src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/// I2C error
#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
/// Bus Busy
BusBusy,
Expand All @@ -17,9 +18,6 @@ pub enum Error {

/// I2C Timeout
Timeout,

#[doc(hidden)]
_Extensible,
}

#[macro_export]
Expand Down
2 changes: 1 addition & 1 deletion tm4c123x-hal/src/hib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ impl Hib {
let subsec: u64 = subsec.into();

let millis: u64 = subsec * 1000 / 32_768;
return seconds * 1000 + millis;
seconds * 1000 + millis
}
}
3 changes: 3 additions & 0 deletions tm4c123x-hal/src/serial.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Serial
// uart_hal_macro can be called with too-many arguments
#![allow(clippy::too_many_arguments)]

pub use tm4c123x::{UART0, UART1, UART2, UART3, UART4, UART5, UART6, UART7};
pub use tm4c_hal::{serial::*, uart_hal_macro, uart_pin_macro};

Expand Down
1 change: 0 additions & 1 deletion tm4c123x-hal/src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::{
time::Hertz,
};

use nb;
use tm4c123x::{SSI0, SSI1, SSI2, SSI3};

/// SPI error
Expand Down
11 changes: 4 additions & 7 deletions tm4c123x-hal/src/sysctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ pub struct Sysctl {
}

/// Used to gate access to the run-time power control features of the chip.
pub struct PowerControl {
_0: (),
}
#[non_exhaustive]
pub struct PowerControl {}

/// Used to configure the clock generators.
#[non_exhaustive]
pub struct ClockSetup {
/// The system oscillator configuration
pub oscillator: Oscillator,
// Make this type uncreatable
_0: (),
}

/// Selects the system oscillator source
Expand Down Expand Up @@ -725,10 +723,9 @@ pub trait SysctlExt {
impl SysctlExt for tm4c123x::SYSCTL {
fn constrain(self) -> Sysctl {
Sysctl {
power_control: PowerControl { _0: () },
power_control: PowerControl {},
clock_setup: ClockSetup {
oscillator: Oscillator::PrecisionInternal(SystemClock::UseOscillator(Divider::_1)),
_0: (),
},
}
}
Expand Down
3 changes: 1 addition & 2 deletions tm4c123x-hal/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
hal::timer::{CountDown, Periodic},
sysctl::{self, Clocks},
};
use nb;

#[rustfmt::skip]
use tm4c123x::{
Expand Down Expand Up @@ -103,7 +102,7 @@ macro_rules! hal {
tim.tamr.write(|w| w.tamr().period());

let mut timer = Timer {
tim:tim,
tim,
clocks: *clocks,
timeout: Hertz(0),
};
Expand Down
2 changes: 1 addition & 1 deletion tm4c129x-hal/src/hib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ impl Hib {
let subsec: u64 = subsec.into();

let millis: u64 = subsec * 1000 / 32_768;
return seconds * 1000 + millis;
seconds * 1000 + millis
}
}
3 changes: 3 additions & 0 deletions tm4c129x-hal/src/serial.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Serial

// uart_hal_macro can be called with too-many arguments
#![allow(clippy::too_many_arguments)]

use core::{fmt, marker::PhantomData};

use crate::{
Expand Down
11 changes: 4 additions & 7 deletions tm4c129x-hal/src/sysctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ pub struct Sysctl {
}

/// Used to gate access to the run-time power control features of the chip.
pub struct PowerControl {
_0: (),
}
#[non_exhaustive]
pub struct PowerControl {}

/// Used to configure the clock generators.
#[non_exhaustive]
pub struct ClockSetup {
/// The system oscillator configuration
pub oscillator: Oscillator,
// Make this type uncreatable
_0: (),
}

/// Selects the system oscillator source
Expand Down Expand Up @@ -746,10 +744,9 @@ pub trait SysctlExt {
impl SysctlExt for tm4c129x::SYSCTL {
fn constrain(self) -> Sysctl {
Sysctl {
power_control: PowerControl { _0: () },
power_control: PowerControl {},
clock_setup: ClockSetup {
oscillator: Oscillator::PrecisionInternal(SystemClock::UseOscillator(Divider::_1)),
_0: (),
},
}
}
Expand Down