Skip to content

Commit

Permalink
Remove redundant assignment of Result values
Browse files Browse the repository at this point in the history
  • Loading branch information
miksquared committed Oct 28, 2024
1 parent a8ceed3 commit 685f9e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/sensors/src/accelerometer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ impl<T: HypedI2c> Accelerometer<T> {
/// Create a new instance of the accelerometer and attempt to configure it
pub fn new(mut i2c: T, device_address: AccelerometerAddresses) -> Result<Self, AccelerometerError> {
let device_address = device_address as u8;
let _ctrl_1_result = match i2c.write_byte_to_register(device_address, LIS2DS12_CTRL1_ADDRESS, LIS2DS12_CTRL1_VALUE) {
match i2c.write_byte_to_register(device_address, LIS2DS12_CTRL1_ADDRESS, LIS2DS12_CTRL1_VALUE) {
Err(e) => return Err(AccelerometerError::I2cError(e)),
Ok(p) => p
};
let _ctrl_2_result = match i2c.write_byte_to_register(device_address, LIS2DS12_CTRL2_ADDRESS, LIS2DS12_CTRL2_VALUE) {
match i2c.write_byte_to_register(device_address, LIS2DS12_CTRL2_ADDRESS, LIS2DS12_CTRL2_VALUE) {
Err(e) => return Err(AccelerometerError::I2cError(e)),
Ok(p) => p
};
let _fifo_ctrl_result = match i2c.write_byte_to_register(device_address, LIS2DS12_FIFO_CTRL_ADDRESS, LIS2DS12_FIFO_CTRL_VALUE) {
match i2c.write_byte_to_register(device_address, LIS2DS12_FIFO_CTRL_ADDRESS, LIS2DS12_FIFO_CTRL_VALUE) {
Err(e) => return Err(AccelerometerError::I2cError(e)),
Ok(p) => p
};
Expand Down

0 comments on commit 685f9e4

Please sign in to comment.