From 1565ff951ec4dcd1a367118b445da87515e5a231 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 1 Feb 2024 13:54:18 +0100 Subject: [PATCH] tape: silence some warnings Nightly rustc now warns about unused private fields in the case of a non-pub newtype struct, so use an underscore-prefixed dummy field name to get rid of the warning. Signed-off-by: Wolfgang Bumiller --- pbs-config/src/lib.rs | 8 +++++--- src/tape/drive/mod.rs | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pbs-config/src/lib.rs b/pbs-config/src/lib.rs index 009c4d3c7..3cfdb2a11 100644 --- a/pbs-config/src/lib.rs +++ b/pbs-config/src/lib.rs @@ -44,12 +44,14 @@ pub fn backup_group() -> Result { } } -pub struct BackupLockGuard(Option); +pub struct BackupLockGuard { + _file: Option, +} #[doc(hidden)] /// Note: do not use for production code, this is only intended for tests pub unsafe fn create_mocked_lock() -> BackupLockGuard { - BackupLockGuard(None) + BackupLockGuard { _file: None } } /// Open or create a lock file owned by user "backup" and lock it. @@ -73,7 +75,7 @@ pub fn open_backup_lockfile>( let timeout = timeout.unwrap_or(std::time::Duration::new(10, 0)); let file = proxmox_sys::fs::open_file_locked(&path, timeout, exclusive, options)?; - Ok(BackupLockGuard(Some(file))) + Ok(BackupLockGuard { _file: Some(file) }) } /// Atomically write data to file owned by "root:backup" with permission "0640" diff --git a/src/tape/drive/mod.rs b/src/tape/drive/mod.rs index 73886f140..63a3592a1 100644 --- a/src/tape/drive/mod.rs +++ b/src/tape/drive/mod.rs @@ -592,7 +592,9 @@ fn tape_device_path(config: &SectionConfigData, drive: &str) -> Result`. @@ -630,7 +632,7 @@ fn lock_device_path(device_path: &str) -> Result } } - Ok(DeviceLockGuard(file)) + Ok(DeviceLockGuard { _file: file }) } // Same logic as lock_device_path, but uses a timeout of 0, making it