clippy: misc. fixes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 11:37:49 +01:00
parent 3f48cdb380
commit ea368a06cd
14 changed files with 23 additions and 28 deletions

View File

@ -24,10 +24,7 @@ pub fn has_encryption<F: AsRawFd>(
Ok(data) => data,
Err(_) => return false,
};
match decode_spin_data_encryption_caps(&data) {
Ok(_) => true,
Err(_) => false,
}
decode_spin_data_encryption_caps(&data).is_ok()
}
/// Set or clear encryption key

View File

@ -17,6 +17,7 @@ bitflags::bitflags!{
///
/// See LTO SCSI Reference LOG_SENSE - LP 2Eh: TapeAlerts
pub struct TapeAlertFlags: u64 {
#[allow(clippy::eq_op)]
const READ_WARNING = 1 << (0x0001 -1);
const WRITE_WARNING = 1 << (0x0002 -1);
const HARD_ERROR = 1 << (0x0003 -1);

View File

@ -201,7 +201,7 @@ impl <'a, F: AsRawFd> SgRaw<'a, F> {
let data_len = self.buffer.len() -
(unsafe { get_scsi_pt_resid(&mut *ptvp) } as usize);
if data_len <= 0 {
if data_len == 0 {
bail!("do_scsi_pt failed - no data received");
}