From e8be3c13fb42e3eb8b8c4e94e0a2191ef6fb45b3 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Mon, 9 Jun 2025 03:43:48 +0000 Subject: [PATCH] dragonball: Fix clippy `missing_docs` Fix `missing_docs` clippy warning as suggested by rust 1.85.1. ```console error: missing documentation for an associated function --> src/device_manager/mod.rs:1299:9 | 1299 | pub fn new_test_mgr() -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D missing-docs` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(missing_docs)]` ``` Signed-off-by: Ruoqing He --- src/dragonball/dbs_utils/src/rate_limiter.rs | 3 ++- src/dragonball/src/device_manager/mod.rs | 1 + src/dragonball/src/vm/mod.rs | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dragonball/dbs_utils/src/rate_limiter.rs b/src/dragonball/dbs_utils/src/rate_limiter.rs index 02d2264f64..c4bda8099b 100644 --- a/src/dragonball/dbs_utils/src/rate_limiter.rs +++ b/src/dragonball/dbs_utils/src/rate_limiter.rs @@ -556,7 +556,8 @@ mod tests { self.processed_refill_time } - // After a restore, we cannot be certain that the last_update field has the same value. + /// Helper function to help comparing `TokenBucket` after update. + /// After a restore, we cannot be certain that the last_update field has the same value. pub fn partial_eq(&self, other: &TokenBucket) -> bool { (other.capacity() == self.capacity()) && (other.one_time_burst() == self.one_time_burst()) diff --git a/src/dragonball/src/device_manager/mod.rs b/src/dragonball/src/device_manager/mod.rs index c8ebeb3b2e..7d89dcb440 100644 --- a/src/dragonball/src/device_manager/mod.rs +++ b/src/dragonball/src/device_manager/mod.rs @@ -1296,6 +1296,7 @@ mod tests { } impl DeviceManager { + /// Helper function to create a dummy DeviceManager for testing purpose pub fn new_test_mgr() -> Self { let kvm = Kvm::new().unwrap(); let vm = kvm.create_vm().unwrap(); diff --git a/src/dragonball/src/vm/mod.rs b/src/dragonball/src/vm/mod.rs index 2ac1cc39d2..37e9f408fb 100644 --- a/src/dragonball/src/vm/mod.rs +++ b/src/dragonball/src/vm/mod.rs @@ -874,6 +874,8 @@ impl Vm { } } +/// Unit test module for methods of struct Vm, and helper functions to shorten +/// test code. #[cfg(test)] pub mod tests { #[cfg(target_arch = "aarch64")] @@ -889,6 +891,7 @@ pub mod tests { use crate::test_utils::tests::create_vm_for_test; impl Vm { + /// Helper function to forch change `mstate` of Vms pub fn set_instance_state(&mut self, mstate: InstanceState) { self.shared_info .write() @@ -897,6 +900,7 @@ pub mod tests { } } + /// Helper function to create dummy Vm instance for testing purpose pub fn create_vm_instance() -> Vm { let instance_info = Arc::new(RwLock::new(InstanceInfo::default())); let epoll_manager = EpollManager::default();