diff --git a/pbs-tape/src/sgutils2.rs b/pbs-tape/src/sgutils2.rs index 8ba0ad29..33db4b5d 100644 --- a/pbs-tape/src/sgutils2.rs +++ b/pbs-tape/src/sgutils2.rs @@ -438,7 +438,7 @@ impl <'a, F: AsRawFd> SgRaw<'a, F> { let mut ptvp = SgPt::new()?; - if self.buffer.len() > 0 { + if !self.buffer.is_empty() { unsafe { set_scsi_pt_data_in( ptvp.as_mut_ptr(), @@ -579,7 +579,7 @@ impl <'a, F: AsRawFd> SgRaw<'a, F> { return Err(format_err!("no valid SCSI command").into()); } - if data.len() == 0 { + if data.is_empty() { return Err(format_err!("got zero-sized input buffer").into()); } diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs index 119149d0..1f5dc4a9 100644 --- a/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs +++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs @@ -35,7 +35,7 @@ impl StaticAuthAdapter { let mut ticket_file = File::open(TICKET_FILE)?; let mut ticket = String::new(); let len = ticket_file.read_to_string(&mut ticket)?; - if len <= 0 { + if len == 0 { bail!("invalid ticket: cannot be empty"); } Ok(StaticAuthAdapter { ticket }) diff --git a/src/api2/access/mod.rs b/src/api2/access/mod.rs index 8805fc00..70bf381d 100644 --- a/src/api2/access/mod.rs +++ b/src/api2/access/mod.rs @@ -92,7 +92,7 @@ fn authenticate_user( if *name == privilege_name { let mut path_vec = Vec::new(); for part in path.split('/') { - if part != "" { + if !part.is_empty() { path_vec.push(part); } } diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs index 2a7705b8..aac1826b 100644 --- a/src/api2/tape/restore.rs +++ b/src/api2/tape/restore.rs @@ -215,7 +215,7 @@ pub fn restore( let store_map = DataStoreMap::try_from(store) .map_err(|err| format_err!("cannot parse store mapping: {}", err))?; let used_datastores = store_map.used_datastores(); - if used_datastores.len() == 0 { + if used_datastores.is_empty() { bail!("no datastores given"); } diff --git a/src/bin/docgen.rs b/src/bin/docgen.rs index a71c9e8b..5600da14 100644 --- a/src/bin/docgen.rs +++ b/src/bin/docgen.rs @@ -24,7 +24,7 @@ fn main() -> Result<(), Error> { let (_prefix, args) = get_args(); - if args.len() < 1 { + if args.is_empty() { bail!("missing arguments"); } diff --git a/src/tools/apt.rs b/src/tools/apt.rs index 3569a006..c884380e 100644 --- a/src/tools/apt.rs +++ b/src/tools/apt.rs @@ -93,7 +93,7 @@ fn get_changelog_url( origin: &str, component: &str, ) -> Result { - if origin == "" { + if origin.is_empty() { bail!("no origin available for package {}", package); }