tool: Fix clippy warnings
Fix: - clippy::unnecessary_cast - clippy::needless_borrow Allow: - clippy::uninlined_format_args - clippy::get_first Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
782f18a3f6
commit
4fa389e1bd
@ -158,7 +158,7 @@ impl Access for AccessLpcLinux {
|
||||
}
|
||||
|
||||
// Write command byte, which starts command
|
||||
self.write_cmd(SMFI_CMD_CMD, cmd as u8)?;
|
||||
self.write_cmd(SMFI_CMD_CMD, cmd)?;
|
||||
|
||||
// Wait for command to finish with timeout
|
||||
self.timeout.reset();
|
||||
|
@ -35,7 +35,7 @@ impl AccessLpcSim {
|
||||
|
||||
fn transaction(&mut self, kind: u8, addr: u16, value: u8) -> io::Result<u8> {
|
||||
let addr = addr.to_le_bytes();
|
||||
let request = [kind as u8, addr[0], addr[1], value];
|
||||
let request = [kind, addr[0], addr[1], value];
|
||||
if self.socket.send(&request)? != request.len() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::UnexpectedEof,
|
||||
@ -99,7 +99,7 @@ impl Access for AccessLpcSim {
|
||||
}
|
||||
|
||||
// Write command byte, which starts command
|
||||
self.write_cmd(SMFI_CMD_CMD, cmd as u8)?;
|
||||
self.write_cmd(SMFI_CMD_CMD, cmd)?;
|
||||
|
||||
// Wait for command to finish with timeout
|
||||
self.timeout.reset();
|
||||
|
@ -1,5 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use clap::{Arg, App, AppSettings, SubCommand};
|
||||
use ectool::{
|
||||
Access,
|
||||
@ -225,6 +227,7 @@ unsafe fn matrix(ec: &mut Ec<Box<dyn Access>>) -> Result<(), Error> {
|
||||
|
||||
let mut data = vec![0; data_size];
|
||||
ec.matrix_get(&mut data)?;
|
||||
#[allow(clippy::get_first)]
|
||||
let rows = *data.get(0).unwrap_or(&0);
|
||||
let cols = *data.get(1).unwrap_or(&0);
|
||||
let mut byte = 2;
|
||||
@ -305,7 +308,7 @@ fn main() {
|
||||
.setting(AppSettings::SubcommandRequired)
|
||||
.arg(Arg::with_name("access")
|
||||
.long("access")
|
||||
.possible_values(&["lpc-linux", "lpc-sim", "hid"])
|
||||
.possible_values(["lpc-linux", "lpc-sim", "hid"])
|
||||
.default_value("lpc-linux")
|
||||
)
|
||||
.subcommand(SubCommand::with_name("console"))
|
||||
@ -386,13 +389,13 @@ fn main() {
|
||||
)
|
||||
.subcommand(SubCommand::with_name("set_no_input")
|
||||
.arg(Arg::with_name("value")
|
||||
.possible_values(&["true", "false"])
|
||||
.possible_values(["true", "false"])
|
||||
.required(true)
|
||||
)
|
||||
)
|
||||
.subcommand(SubCommand::with_name("security")
|
||||
.arg(Arg::with_name("state")
|
||||
.possible_values(&["lock", "unlock"])
|
||||
.possible_values(["lock", "unlock"])
|
||||
)
|
||||
)
|
||||
.get_matches();
|
||||
|
@ -154,6 +154,7 @@ impl<'a, S: Spi, T: Timeout> SpiRom<'a, S, T> {
|
||||
//TODO: automatically detect write command
|
||||
match self.spi.target() {
|
||||
SpiTarget::Main => for (i, word) in data.chunks(2).enumerate() {
|
||||
#[allow(clippy::get_first)]
|
||||
let low = *word.get(0).unwrap_or(&0xFF);
|
||||
let high = *word.get(1).unwrap_or(&0xFF);
|
||||
|
||||
|
Reference in New Issue
Block a user