Skip to content

Commit c1d5e98

Browse files
committed
refactor: address lint errors
1 parent 923ecf0 commit c1d5e98

8 files changed

Lines changed: 44 additions & 46 deletions

File tree

‎crates/openshell-cli/src/run.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6925,8 +6925,6 @@ mod tests {
69256925
refresh_status_row, resolve_from, sandbox_should_persist, sandbox_upload_plan,
69266926
service_expose_status_error, service_url_for_gateway,
69276927
};
6928-
#[cfg(unix)]
6929-
use super::{local_upload_path_exists, local_upload_path_is_symlink};
69306928
use crate::TEST_ENV_LOCK;
69316929
use crate::commands::common::progress_step_from_metadata;
69326930
use crate::test_utils::EnvVarGuard;

‎crates/openshell-driver-docker/src/lib.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//! Docker compute driver.
5-
6-
#![allow(clippy::result_large_err)]
7-
84
use bollard::Docker;
95
use bollard::errors::Error as BollardError;
106
use bollard::models::{

‎crates/openshell-driver-docker/src/lib_entry.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
//! Docker compute driver.
5+
6+
#![allow(clippy::result_large_err)]
7+
48
#[cfg(not(target_os = "windows"))]
59
include!("lib.rs");
610

‎crates/openshell-driver-vm/src/driver.rs‎

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,7 +5648,7 @@ mod tests {
56485648
async fn sandbox_request_metadata_round_trips_for_resume() {
56495649
let base = unique_temp_dir();
56505650
let state_dir = base.join("sandboxes").join("sandbox-123");
5651-
std::fs::create_dir_all(&state_dir).unwrap();
5651+
fs::create_dir_all(&state_dir).unwrap();
56525652
let sandbox = Sandbox {
56535653
id: "sandbox-123".to_string(),
56545654
name: "resume-sandbox".to_string(),
@@ -5676,8 +5676,8 @@ mod tests {
56765676
{
56775677
use std::os::unix::fs::PermissionsExt as _;
56785678

5679-
let dir_mode = std::fs::metadata(&state_dir).unwrap().permissions().mode() & 0o777;
5680-
let file_mode = std::fs::metadata(state_dir.join(SANDBOX_REQUEST_FILE))
5679+
let dir_mode = fs::metadata(&state_dir).unwrap().permissions().mode() & 0o777;
5680+
let file_mode = fs::metadata(state_dir.join(SANDBOX_REQUEST_FILE))
56815681
.unwrap()
56825682
.permissions()
56835683
.mode()
@@ -5688,17 +5688,17 @@ mod tests {
56885688
validate_restored_sandbox_state(&base, &state_dir, &restored)
56895689
.expect("restored state should validate");
56905690

5691-
let _ = std::fs::remove_dir_all(base);
5691+
let _ = fs::remove_dir_all(base);
56925692
}
56935693

56945694
#[test]
56955695
fn prepare_sandbox_overlay_preserves_existing_overlay_on_resume() {
56965696
let base = unique_temp_dir();
5697-
std::fs::create_dir_all(&base).unwrap();
5697+
fs::create_dir_all(&base).unwrap();
56985698
let template = base.join("template.ext4");
56995699
let overlay = base.join("overlay.ext4");
5700-
std::fs::write(&template, b"fresh-overlay").unwrap();
5701-
std::fs::write(&overlay, b"saved-overlay").unwrap();
5700+
fs::write(&template, b"fresh-overlay").unwrap();
5701+
fs::write(&overlay, b"saved-overlay").unwrap();
57025702

57035703
prepare_sandbox_overlay_image(
57045704
&template,
@@ -5710,18 +5710,18 @@ mod tests {
57105710
)
57115711
.expect("preserve existing overlay");
57125712

5713-
assert_eq!(std::fs::read(&overlay).unwrap(), b"saved-overlay");
5713+
assert_eq!(fs::read(&overlay).unwrap(), b"saved-overlay");
57145714

5715-
let _ = std::fs::remove_dir_all(base);
5715+
let _ = fs::remove_dir_all(base);
57165716
}
57175717

57185718
#[test]
57195719
fn prepare_sandbox_overlay_creates_missing_overlay_on_resume() {
57205720
let base = unique_temp_dir();
5721-
std::fs::create_dir_all(&base).unwrap();
5721+
fs::create_dir_all(&base).unwrap();
57225722
let template = base.join("template.ext4");
57235723
let overlay = base.join("overlay.ext4");
5724-
std::fs::write(&template, b"fresh-overlay").unwrap();
5724+
fs::write(&template, b"fresh-overlay").unwrap();
57255725

57265726
prepare_sandbox_overlay_image(
57275727
&template,
@@ -5733,9 +5733,9 @@ mod tests {
57335733
)
57345734
.expect("create missing overlay");
57355735

5736-
assert_eq!(std::fs::read(&overlay).unwrap(), b"fresh-overlay");
5736+
assert_eq!(fs::read(&overlay).unwrap(), b"fresh-overlay");
57375737

5738-
let _ = std::fs::remove_dir_all(base);
5738+
let _ = fs::remove_dir_all(base);
57395739
}
57405740

57415741
#[test]
@@ -6317,8 +6317,8 @@ mod tests {
63176317
};
63186318

63196319
let state_file = sandbox_state_dir(&driver_state, "sandbox-123").unwrap();
6320-
std::fs::create_dir_all(state_file.parent().unwrap()).unwrap();
6321-
std::fs::write(&state_file, "not a directory").unwrap();
6320+
fs::create_dir_all(state_file.parent().unwrap()).unwrap();
6321+
fs::write(&state_file, "not a directory").unwrap();
63226322

63236323
insert_test_record(
63246324
&driver,
@@ -6335,9 +6335,9 @@ mod tests {
63356335
assert!(err.message().contains("not a directory"));
63366336
assert!(driver.registry.lock().await.contains_key("sandbox-123"));
63376337

6338-
std::fs::remove_file(&state_file).unwrap();
6338+
fs::remove_file(&state_file).unwrap();
63396339
let retry_state_dir = sandbox_state_dir(&driver_state, "sandbox-123").unwrap();
6340-
std::fs::create_dir_all(&retry_state_dir).unwrap();
6340+
fs::create_dir_all(&retry_state_dir).unwrap();
63416341
{
63426342
let mut registry = driver.registry.lock().await;
63436343
let record = registry.get_mut("sandbox-123").unwrap();
@@ -6355,7 +6355,7 @@ mod tests {
63556355
assert!(response.deleted);
63566356
assert!(!driver.registry.lock().await.contains_key("sandbox-123"));
63576357

6358-
let _ = std::fs::remove_dir_all(base);
6358+
let _ = fs::remove_dir_all(base);
63596359
}
63606360

63616361
#[tokio::test]
@@ -6381,7 +6381,7 @@ mod tests {
63816381
};
63826382

63836383
let state_dir = sandbox_state_dir(&driver_state, "sandbox-123").unwrap();
6384-
std::fs::create_dir_all(&state_dir).unwrap();
6384+
fs::create_dir_all(&state_dir).unwrap();
63856385
{
63866386
let mut registry = driver.registry.lock().await;
63876387
registry.insert(
@@ -6410,7 +6410,7 @@ mod tests {
64106410
assert!(!driver.registry.lock().await.contains_key("sandbox-123"));
64116411
assert!(!state_dir.exists());
64126412

6413-
let _ = std::fs::remove_dir_all(base);
6413+
let _ = fs::remove_dir_all(base);
64146414
}
64156415

64166416
#[tokio::test]
@@ -6437,8 +6437,8 @@ mod tests {
64376437
};
64386438

64396439
let state_dir = sandbox_state_dir(&driver_state, "sandbox-123").unwrap();
6440-
std::fs::create_dir_all(&state_dir).unwrap();
6441-
std::fs::write(state_dir.join("overlay.ext4"), b"live overlay").unwrap();
6440+
fs::create_dir_all(&state_dir).unwrap();
6441+
fs::write(state_dir.join("overlay.ext4"), b"live overlay").unwrap();
64426442
{
64436443
let mut registry = driver.registry.lock().await;
64446444
registry.insert(
@@ -6473,22 +6473,22 @@ mod tests {
64736473
assert!(state_dir.join("overlay.ext4").exists());
64746474
assert!(driver.registry.lock().await.contains_key("sandbox-123"));
64756475

6476-
let _ = std::fs::remove_dir_all(base);
6476+
let _ = fs::remove_dir_all(base);
64776477
}
64786478

64796479
#[tokio::test]
64806480
async fn remove_sandbox_state_dir_rejects_paths_outside_state_root() {
64816481
let base = unique_temp_dir();
64826482
let state_root = base.join("driver-state");
64836483
let outside = base.join("outside");
6484-
std::fs::create_dir_all(&outside).unwrap();
6484+
fs::create_dir_all(&outside).unwrap();
64856485

64866486
let err = remove_sandbox_state_dir(&state_root, &outside)
64876487
.await
64886488
.expect_err("outside state paths should be rejected");
64896489
assert!(err.message().contains("outside vm state root"));
64906490

6491-
let _ = std::fs::remove_dir_all(base);
6491+
let _ = fs::remove_dir_all(base);
64926492
}
64936493

64946494
#[cfg(unix)]
@@ -6498,16 +6498,16 @@ mod tests {
64986498
let state_root = base.join("driver-state");
64996499
let target = base.join("target");
65006500
let state_dir = sandbox_state_dir(&state_root, "sandbox-123").unwrap();
6501-
std::fs::create_dir_all(&target).unwrap();
6502-
std::fs::create_dir_all(state_dir.parent().unwrap()).unwrap();
6501+
fs::create_dir_all(&target).unwrap();
6502+
fs::create_dir_all(state_dir.parent().unwrap()).unwrap();
65036503
std::os::unix::fs::symlink(&target, &state_dir).unwrap();
65046504

65056505
let err = remove_sandbox_state_dir(&state_root, &state_dir)
65066506
.await
65076507
.expect_err("symlinked state dir should be rejected");
65086508
assert!(err.message().contains("symlinked sandbox state dir"));
65096509

6510-
let _ = std::fs::remove_dir_all(base);
6510+
let _ = fs::remove_dir_all(base);
65116511
}
65126512

65136513
#[test]
@@ -6607,7 +6607,7 @@ mod tests {
66076607
"blob"
66086608
);
66096609

6610-
let _ = std::fs::remove_dir_all(base);
6610+
let _ = fs::remove_dir_all(base);
66116611
}
66126612

66136613
#[test]
@@ -6673,7 +6673,7 @@ mod tests {
66736673

66746674
assert!(err.contains("ca.crt"));
66756675

6676-
let _ = std::fs::remove_dir_all(base);
6676+
let _ = fs::remove_dir_all(base);
66776677
}
66786678

66796679
#[cfg(unix)]
@@ -6715,7 +6715,7 @@ mod tests {
67156715
0o600
67166716
);
67176717

6718-
let _ = std::fs::remove_dir_all(base);
6718+
let _ = fs::remove_dir_all(base);
67196719
}
67206720

67216721
#[test]
@@ -6969,13 +6969,13 @@ mod tests {
69696969
assert!(err.message().contains("external kernel images"));
69706970

69716971
let base = unique_temp_dir();
6972-
std::fs::create_dir_all(&base).unwrap();
6972+
fs::create_dir_all(&base).unwrap();
69736973
let kernel = base.join("vmlinux");
6974-
std::fs::write(&kernel, b"kernel").unwrap();
6974+
fs::write(&kernel, b"kernel").unwrap();
69756975
plan.backend = VmBackend::Qemu;
69766976
plan.kernel_image = Some(kernel);
69776977
VmDriver::validate_launch_plan_backend(true, &plan).expect("existing kernel is accepted");
6978-
let _ = std::fs::remove_dir_all(base);
6978+
let _ = fs::remove_dir_all(base);
69796979
}
69806980

69816981
#[test]

‎crates/openshell-sandbox/src/lib.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//! `OpenShell` Sandbox library.
5-
//!
6-
//! This crate provides process sandboxing and monitoring capabilities.
7-
84
mod activity_aggregator;
95
mod denial_aggregator;
106
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]

‎crates/openshell-sandbox/src/lib_entry.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
//! `OpenShell` Sandbox library.
5+
//!
6+
//! This crate provides process sandboxing and monitoring capabilities.
7+
48
#[cfg(not(target_os = "windows"))]
59
include!("lib.rs");
610

‎crates/openshell-sandbox/src/main.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//! `OpenShell` Sandbox - process sandbox and monitor.
5-
64
use std::path::Path;
75
use std::sync::Arc;
86
use std::sync::atomic::AtomicBool;

‎crates/openshell-sandbox/src/main_entry.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
//! `OpenShell` Sandbox - process sandbox and monitor.
5+
46
#[cfg(not(target_os = "windows"))]
57
include!("main.rs");
68

0 commit comments

Comments
 (0)