Skip to content

Commit b283b82

Browse files
committed
Fix warnings
1 parent ea3ee5b commit b283b82

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

examples/nunchuck.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ mod nunchuck {
5858

5959
#[derive(Debug)]
6060
pub struct NunchuckReading {
61-
joystick_x: u8,
62-
joystick_y: u8,
63-
accel_x: u16, // 10-bit
64-
accel_y: u16, // 10-bit
65-
accel_z: u16, // 10-bit
66-
c_button_pressed: bool,
67-
z_button_pressed: bool,
61+
pub joystick_x: u8,
62+
pub joystick_y: u8,
63+
pub accel_x: u16, // 10-bit
64+
pub accel_y: u16, // 10-bit
65+
pub accel_z: u16, // 10-bit
66+
pub c_button_pressed: bool,
67+
pub z_button_pressed: bool,
6868
}
6969

7070
impl NunchuckReading {

examples/sensors.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ mod sensors {
285285
// If values are less than 16 bytes, need to adjust
286286
let extrabits = 16 - integer_bits - fractional_bits - 1;
287287
let rawval: i16 = BigEndian::read_i16(&[msb, lsb]);
288-
let adj = (f32::from(rawval) / 2_f32.powi(fractional_bits + extrabits))
289-
/ 10_f32.powi(dec_pt_zero_pad);
290-
adj
288+
(f32::from(rawval) / 2_f32.powi(fractional_bits + extrabits))
289+
/ 10_f32.powi(dec_pt_zero_pad)
291290
}
292291

293292
impl MPL115A2Coefficients {

src/ffi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ pub fn i2c_smbus_read_block_data(fd: RawFd, register: u8) -> Result<Vec<u8>, I2C
354354
// create a vector from the data in the block starting at byte
355355
// 1 and ending after count bytes after that
356356
let count = data.block[0];
357-
Ok((&data.block[1..(count + 1) as usize]).to_vec())
357+
Ok((data.block[1..(count + 1) as usize]).to_vec())
358358
}
359359

360360
pub fn i2c_smbus_read_i2c_block_data(
@@ -377,7 +377,7 @@ pub fn i2c_smbus_read_i2c_block_data(
377377
// create a vector from the data in the block starting at byte
378378
// 1 and ending after count bytes after that
379379
let count = data.block[0];
380-
Ok((&data.block[1..(count + 1) as usize]).to_vec())
380+
Ok((data.block[1..(count + 1) as usize]).to_vec())
381381
}
382382

383383
#[inline]
@@ -445,7 +445,7 @@ pub fn i2c_smbus_process_call_block(
445445
// create a vector from the data in the block starting at byte
446446
// 1 and ending after count bytes after that
447447
let count = data.block[0];
448-
Ok((&data.block[1..(count + 1) as usize]).to_vec())
448+
Ok((data.block[1..(count + 1) as usize]).to_vec())
449449
}
450450

451451
#[inline]

src/linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl<'a> I2CTransfer<'a> for LinuxI2CDevice {
301301
/// Issue the provided sequence of I2C transactions
302302
fn transfer(&mut self, messages: &'a mut [Self::Message]) -> Result<u32, LinuxI2CError> {
303303
for msg in messages.iter_mut() {
304-
(*msg).addr = self.slave_address;
304+
msg.addr = self.slave_address;
305305
}
306306
ffi::i2c_rdwr(self.as_raw_fd(), messages).map_err(From::from)
307307
}

0 commit comments

Comments
 (0)