Skip to content

Commit

Permalink
Fix clippy issues
Browse files Browse the repository at this point in the history
The result of running `cargo clippy --fix --all-targets --all-features`
twice.
  • Loading branch information
rnestler committed May 12, 2024
1 parent 3cdb49f commit a2f9295
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions examples/monitor-shtc3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fn show_chart<B: Backend>(
.name("Low power mode")
.marker(Marker::Braille)
.style(Style::default().fg(color_lowpwr))
.data(&data_lowpwr),
.data(data_lowpwr),
Dataset::default()
.name("Normal mode")
.marker(Marker::Dot)
Expand Down Expand Up @@ -175,7 +175,7 @@ fn show_chart<B: Backend>(

fn render(terminal: &mut Terminal<CrosstermBackend<RawTerminal<Stdout>>>, data: &Data) {
terminal
.draw(|mut f| {
.draw(|f| {
let chunks = Layout::default()
.direction(Direction::Vertical)
.margin(1)
Expand Down Expand Up @@ -216,7 +216,7 @@ fn render(terminal: &mut Terminal<CrosstermBackend<RawTerminal<Stdout>>>, data:
Color::Red,
temp_lowpwr.as_slice(),
Color::Magenta,
&mut f,
f,
chunks[0],
);
show_chart(
Expand All @@ -226,7 +226,7 @@ fn render(terminal: &mut Terminal<CrosstermBackend<RawTerminal<Stdout>>>, data:
Color::Blue,
humi_lowpwr.as_slice(),
Color::Cyan,
&mut f,
f,
chunks[1],
);
})
Expand Down
12 changes: 6 additions & 6 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mod tests {
let test_data = [
(0x0000, -45000),
// Datasheet setion 5.11 "Conversion of Sensor Output"
(((0b0110_0100 as u16) << 8) | 0b1000_1011, 23730),
((0b0110_0100_u16 << 8) | 0b1000_1011, 23730),
];
for td in &test_data {
assert_eq!(convert_temperature(td.0), td.1);
Expand All @@ -111,7 +111,7 @@ mod tests {
let test_data = [
(0x0000, 0),
// Datasheet setion 5.11 "Conversion of Sensor Output"
(((0b1010_0001 as u16) << 8) | 0b0011_0011, 62968),
((0b1010_0001_u16 << 8) | 0b0011_0011, 62968),
];
for td in &test_data {
assert_eq!(convert_humidity(td.0), td.1);
Expand All @@ -122,8 +122,8 @@ mod tests {
#[test]
fn measurement_conversion() {
// Datasheet setion 5.11 "Conversion of Sensor Output"
let temperature = convert_temperature(((0b0110_0100 as u16) << 8) | 0b1000_1011);
let humidity = convert_humidity(((0b1010_0001 as u16) << 8) | 0b0011_0011);
let temperature = convert_temperature((0b0110_0100_u16 << 8) | 0b1000_1011);
let humidity = convert_humidity((0b1010_0001_u16 << 8) | 0b0011_0011);
assert_eq!(temperature, 23730);
assert_eq!(humidity, 62968);
}
Expand All @@ -146,8 +146,8 @@ mod tests {
fn measurement_from_into() {
// Datasheet setion 5.11 "Conversion of Sensor Output"
let raw = RawMeasurement {
temperature: ((0b0110_0100 as u16) << 8) | 0b1000_1011,
humidity: ((0b1010_0001 as u16) << 8) | 0b0011_0011,
temperature: (0b0110_0100_u16 << 8) | 0b1000_1011,
humidity: (0b1010_0001_u16 << 8) | 0b0011_0011,
};

// std::convert::From
Expand Down

0 comments on commit a2f9295

Please sign in to comment.