agent: Fix clippy partialeq_to_none

Fix `partialeq_to_none` clippy warning as suggested by rust 1.85.1.

```console
warning: binary comparison to literal `Option::None`
   --> src/sandbox.rs:431:16
    |
431 |             if src_ctrs.get(&shared_mount.src_ctr) == None {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `Option::is_none()` instead: `src_ctrs.get(&shared_mount.src_ctr).is_none()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_to_none
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
Ruoqing He 2025-05-26 03:51:39 +00:00
parent 95dca31ecc
commit 54ec432178

View File

@ -428,7 +428,7 @@ impl Sandbox {
pub fn setup_shared_mounts(&self, c: &LinuxContainer, mounts: &Vec<SharedMount>) -> Result<()> {
let mut src_ctrs: HashMap<String, i32> = HashMap::new();
for shared_mount in mounts {
if src_ctrs.get(&shared_mount.src_ctr) == None {
if src_ctrs.get(&shared_mount.src_ctr).is_none() {
if let Some(c) = self.find_container_by_name(&shared_mount.src_ctr) {
src_ctrs.insert(shared_mount.src_ctr.clone(), c.init_process_pid);
}