Skip to content

Commit 9a4e9aa

Browse files
authored
Repo: cleanup some attributes (#2230)
Remove some unneeded attributes, move some around, tweak some to be cleaner, add some more forbid(unsafe_code)s.
1 parent 9582f71 commit 9a4e9aa

File tree

20 files changed

+36
-22
lines changed

20 files changed

+36
-22
lines changed

flowey/flowey_hvlite/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
//! Flowey pipelines used by the OpenVMM project
55
6+
#![forbid(unsafe_code)]
7+
68
fn main() {
79
flowey_cli::flowey_main::<flowey_hvlite::pipelines::OpenvmmPipelines>(
810
"flowey_hvlite",

hyperv/tools/hypestv/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
//! Interactive CLI for Hyper-V VMs.
55
6+
#![forbid(unsafe_code)]
7+
68
mod windows;
79

810
#[cfg(windows)]

openhcl/ohcldiag-dev/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! guarantees.
66
77
#![expect(missing_docs)]
8+
#![forbid(unsafe_code)]
89

910
mod completions;
1011

openhcl/openvmm_hcl/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
//! Root binary crate for builds of OpenVMM-HCL.
55
6+
#![forbid(unsafe_code)]
7+
68
// Link resources.
79
#[cfg(target_os = "linux")]
810
use openvmm_hcl_resources as _;

openvmm/openvmm/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
//! Root binary crate for OpenVMM.
55
6+
#![forbid(unsafe_code)]
7+
68
// Ensure openvmm_resources gets linked.
79
extern crate openvmm_resources as _;
810

petri/petri-tool/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
//! Tool for using petri functionality from the command line.
55
6+
#![forbid(unsafe_code)]
7+
68
use anyhow::Context as _;
79
use clap::Parser;
810
use petri::ArtifactResolver;

petri/pipette/src/agent.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
//! The main pipette agent, which is run when the process starts.
55
6-
#![cfg(any(target_os = "linux", target_os = "windows"))]
7-
86
use anyhow::Context;
97
use futures::future::FutureExt;
108
use futures_concurrency::future::RaceOk;

petri/pipette/src/execute.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
//! Handler for the execute request.
55
6-
#![cfg(any(target_os = "linux", target_os = "windows"))]
7-
86
use futures::executor::block_on;
97
use futures::io::AllowStdIo;
108
use std::process::Stdio;

petri/pipette/src/main.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@
44
//! This is the petri pipette agent, which runs on the guest and executes
55
//! commands and other requests from the host.
66
7+
#![cfg_attr(not(windows), forbid(unsafe_code))]
8+
9+
#[cfg(any(target_os = "linux", windows))]
710
mod agent;
11+
#[cfg(any(target_os = "linux", windows))]
812
mod execute;
13+
#[cfg(any(target_os = "linux", windows))]
914
mod shutdown;
15+
#[cfg(any(target_os = "linux", windows))]
1016
mod trace;
1117
#[cfg(windows)]
1218
mod winsvc;
1319

14-
// This is here to satisfy rust-analyzer on macos. Pipette does not yet support
15-
// macos.
16-
#[cfg(target_os = "macos")]
17-
fn main() -> anyhow::Result<()> {
18-
anyhow::bail!("unsupported on macos")
19-
}
20-
21-
#[cfg(any(target_os = "linux", target_os = "windows"))]
20+
#[cfg(any(target_os = "linux", windows))]
2221
fn main() -> anyhow::Result<()> {
2322
#[cfg(windows)]
2423
if std::env::args().nth(1).as_deref() == Some("--service") {
@@ -30,3 +29,8 @@ fn main() -> anyhow::Result<()> {
3029
agent.run().await
3130
})
3231
}
32+
33+
#[cfg(not(any(target_os = "linux", windows)))]
34+
fn main() -> anyhow::Result<()> {
35+
anyhow::bail!("unsupported platform");
36+
}

petri/pipette/src/shutdown.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
//! Handler for the power off request.
55
6-
#![cfg(any(target_os = "linux", target_os = "windows"))]
76
// UNSAFETY: required for Windows shutdown API
87
#![cfg_attr(windows, expect(unsafe_code))]
98

0 commit comments

Comments
 (0)