Skip to content

Commit 1cde7ab

Browse files
authored
Convert all allow(missing_docs) to expects (#533)
Working towards #300 and #287
1 parent fe6466b commit 1cde7ab

File tree

56 files changed

+78
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+78
-105
lines changed

openhcl/hcl/src/ioctl.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ use zerocopy::FromZeroes;
8383

8484
/// Error returned by HCL operations.
8585
#[derive(Error, Debug)]
86-
#[allow(missing_docs)]
86+
#[expect(missing_docs)]
8787
pub enum Error {
8888
#[error("failed to open mshv device")]
8989
OpenMshv(#[source] io::Error),
@@ -151,7 +151,7 @@ pub struct IoctlError(#[source] pub(crate) nix::Error);
151151

152152
/// Error returned when issuing hypercalls.
153153
#[derive(Debug, Error)]
154-
#[allow(missing_docs)]
154+
#[expect(missing_docs)]
155155
pub enum HypercallError {
156156
#[error("hypercall failed with {0:?}")]
157157
Hypervisor(HvError),
@@ -173,7 +173,7 @@ impl HypercallError {
173173

174174
/// Errors when issuing hypercalls via the kernel direct interface.
175175
#[derive(Error, Debug)]
176-
#[allow(missing_docs)]
176+
#[expect(missing_docs)]
177177
pub enum HvcallError {
178178
#[error("kernel rejected the hypercall, most likely due to the hypercall code not being allowed via set_allowed_hypercalls")]
179179
HypercallIoctlFailed(#[source] nix::Error),
@@ -188,7 +188,7 @@ pub enum HvcallError {
188188
/// Error applying VTL protections.
189189
// TODO: move to `underhill_mem`.
190190
#[derive(Error, Debug)]
191-
#[allow(missing_docs)]
191+
#[expect(missing_docs)]
192192
pub enum ApplyVtlProtectionsError {
193193
#[error(
194194
"hypervisor returned {output:?} error {hv_error:?} when protecting pages {range} for vtl {vtl:?}"
@@ -223,7 +223,7 @@ pub enum ApplyVtlProtectionsError {
223223

224224
/// Error setting guest VSM configuration.
225225
#[derive(Error, Debug)]
226-
#[allow(missing_docs)]
226+
#[expect(missing_docs)]
227227
pub enum SetGuestVsmConfigError {
228228
#[error(
229229
"hypervisor returned error {hv_error:?} when configuring guest vsm {enable_guest_vsm:?}"
@@ -236,15 +236,15 @@ pub enum SetGuestVsmConfigError {
236236

237237
/// Error getting the VP idnex from an APIC ID.
238238
#[derive(Error, Debug)]
239-
#[allow(missing_docs)]
239+
#[expect(missing_docs)]
240240
pub enum GetVpIndexFromApicIdError {
241241
#[error("hypervisor returned error {hv_error:?} when querying vp index for {apic_id}")]
242242
Hypervisor { hv_error: HvError, apic_id: u32 },
243243
}
244244

245245
/// Error setting VSM partition configuration.
246246
#[derive(Error, Debug)]
247-
#[allow(missing_docs)]
247+
#[expect(missing_docs)]
248248
pub enum SetVsmPartitionConfigError {
249249
#[error(
250250
"hypervisor returned error {hv_error:?} when configuring vsm partition config {config:?}"
@@ -257,7 +257,7 @@ pub enum SetVsmPartitionConfigError {
257257

258258
/// Error translating a GVA to a GPA.
259259
#[derive(Error, Debug)]
260-
#[allow(missing_docs)]
260+
#[expect(missing_docs)]
261261
pub enum TranslateGvaToGpaError {
262262
#[error("hypervisor returned error {hv_error:?} on gva {gva:x}")]
263263
Hypervisor { gva: u64, hv_error: HvError },
@@ -281,7 +281,7 @@ pub struct CheckVtlAccessResult {
281281
/// Error accepting pages.
282282
// TODO: move to `underhill_mem`.
283283
#[derive(Error, Debug)]
284-
#[allow(missing_docs)]
284+
#[expect(missing_docs)]
285285
pub enum AcceptPagesError {
286286
#[error("hypervisor returned {output:?} error {hv_error:?} when accepting pages {range}")]
287287
Hypervisor {

openhcl/hcl/src/ioctl/snp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct Snp {
3434

3535
/// Error returned by failing SNP operations.
3636
#[derive(Debug, Error)]
37-
#[allow(missing_docs)]
37+
#[expect(missing_docs)]
3838
pub enum SnpError {
3939
#[error("operating system error")]
4040
Os(#[source] nix::Error),
@@ -44,7 +44,7 @@ pub enum SnpError {
4444

4545
/// Error returned by failing SNP page operations.
4646
#[derive(Debug, Error)]
47-
#[allow(missing_docs)]
47+
#[expect(missing_docs)]
4848
pub enum SnpPageError {
4949
#[error("pvalidate failed")]
5050
Pvalidate(#[source] SnpError),

openhcl/hcl/src/ioctl/x64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct TranslateErrorX64 {
3737

3838
/// Result when the intercepted vtl is invalid.
3939
#[derive(Error, Debug)]
40-
#[allow(missing_docs)]
40+
#[expect(missing_docs)]
4141
pub enum RegisterPageVtlError {
4242
#[error("no register page")]
4343
NoRegisterPage,

openhcl/hcl/src/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use thiserror::Error;
99

1010
/// Error returned by [`vp_stats`].
1111
#[derive(Debug, Error)]
12-
#[allow(missing_docs)]
12+
#[expect(missing_docs)]
1313
pub enum VpStatsError {
1414
#[error("failed to read /proc/mshv")]
1515
Read(#[source] std::io::Error),

openhcl/underhill_attestation/src/crypto.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ use openssl::rsa::Rsa;
1010
use openssl_kdf::kdf::Kbkdf;
1111
use thiserror::Error;
1212

13-
#[allow(missing_docs)] // self-explanatory fields
1413
#[derive(Debug, Error)]
1514
pub(crate) enum KbkdfError {
1615
#[error("KDF derivation failed")]
1716
Derive(#[from] openssl_kdf::kdf::KdfError),
1817
}
1918

20-
#[allow(missing_docs)] // self-explanatory fields
2119
#[derive(Debug, Error)]
2220
pub(crate) enum Pkcs11RsaAesKeyUnwrapError {
2321
#[error("expected wrapped AES key blob to be {0} bytes, but found {1} bytes")]
@@ -34,7 +32,6 @@ pub(crate) enum Pkcs11RsaAesKeyUnwrapError {
3432
PkeyToRsa(#[from] openssl::error::ErrorStack),
3533
}
3634

37-
#[allow(missing_docs)] // self-explanatory fields
3835
#[derive(Debug, Error)]
3936
pub(crate) enum RsaOaepError {
4037
#[error("failed to convert an RSA key to PKey")]
@@ -55,7 +52,6 @@ pub(crate) enum RsaOaepError {
5552
Decrypt(#[source] openssl::error::ErrorStack, RsaOaepHashAlgorithm),
5653
}
5754

58-
#[allow(missing_docs)] // self-explanatory fields
5955
#[derive(Debug, Error)]
6056
pub(crate) enum AesKeyWrapWithPaddingError {
6157
#[error("invalid wrapping key size {0}")]
@@ -74,7 +70,6 @@ pub(crate) enum AesKeyWrapWithPaddingError {
7470
UnwrapUpdate(#[source] openssl::error::ErrorStack),
7571
}
7672

77-
#[allow(missing_docs)] // self-explanatory fields
7873
#[derive(Debug, Error)]
7974
pub(crate) enum Aes256CbcError {
8075
#[error("CipherCtx::new failed")]
@@ -89,7 +84,6 @@ pub(crate) enum Aes256CbcError {
8984
Decrypt(#[source] openssl::error::ErrorStack),
9085
}
9186

92-
#[allow(missing_docs)] // self-explanatory fields
9387
#[derive(Debug, Error)]
9488
pub(crate) enum HmacSha256Error {
9589
#[error("failed to convert an HMAC key to PKey")]

openhcl/underhill_attestation/src/hardware_key_sealing.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use openssl_kdf::kdf::Kbkdf;
1414
use thiserror::Error;
1515
use zerocopy::AsBytes;
1616

17-
#[allow(missing_docs)] // self-explanatory fields
1817
#[derive(Debug, Error)]
1918
pub(crate) enum HardwareDerivedKeysError {
2019
#[error("failed to initialize hardware secret")]
@@ -23,7 +22,6 @@ pub(crate) enum HardwareDerivedKeysError {
2322
KdfWithHardwareSecret(#[source] openssl_kdf::kdf::KdfError),
2423
}
2524

26-
#[allow(missing_docs)] // self-explanatory fields
2725
#[derive(Debug, Error)]
2826
pub(crate) enum HardwareKeySealingError {
2927
#[error("failed to encrypt the egress key")]

openhcl/underhill_attestation/src/igvm_attest/key_release.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ use openssl::rsa::Padding;
1313
use openssl::sign::Verifier;
1414
use openssl::x509::X509VerifyResult;
1515
use openssl::x509::X509;
16-
use thiserror::Error;
17-
1816
use std::fmt::Write;
17+
use thiserror::Error;
1918

20-
#[allow(missing_docs)] // self-explanatory fields
2119
#[derive(Debug, Error)]
2220
pub(crate) enum KeyReleaseError {
2321
#[error("the response size is too small to parse")]
@@ -32,7 +30,6 @@ pub(crate) enum KeyReleaseError {
3230
GetWrappedKeyFromAkvJwtBody(#[source] AkvKeyReleaseJwtError),
3331
}
3432

35-
#[allow(missing_docs)] // self-explanatory fields
3633
#[derive(Debug, Error)]
3734
pub(crate) enum AkvKeyReleaseJwtError {
3835
#[error("JWT data is not valid UTF-8: {0}")]
@@ -65,7 +62,6 @@ pub(crate) enum AkvKeyReleaseJwtError {
6562
KeyHsmBlobToJson(#[source] serde_json::Error),
6663
}
6764

68-
#[allow(missing_docs)] // self-explanatory fields
6965
#[derive(Debug, Error)]
7066
pub(crate) enum JwtSignatureVerificationError {
7167
#[error("invalid key type {key_type:?}, expected {expected_type:?}")]
@@ -85,7 +81,6 @@ pub(crate) enum JwtSignatureVerificationError {
8581
UnsupportedSigningAlgorithm(String),
8682
}
8783

88-
#[allow(missing_docs)] // self-explanatory fields
8984
#[derive(Debug, Error)]
9085
pub(crate) enum CertificateChainValidationError {
9186
#[error("certificate chain is empty")]

openhcl/underhill_attestation/src/igvm_attest/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub mod wrapped_key;
2121

2222
base64_serde_type!(Base64Url, base64::engine::general_purpose::URL_SAFE_NO_PAD);
2323

24-
#[allow(missing_docs)] // self-explanatory fields
24+
#[expect(missing_docs)] // self-explanatory fields
2525
#[derive(Debug, Error)]
2626
pub enum Error {
2727
#[error(

openhcl/underhill_attestation/src/igvm_attest/wrapped_key.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use openhcl_attestation_protocol::igvm_attest::cps;
88
use thiserror::Error;
99

10-
#[allow(missing_docs)] // self-explanatory fields
1110
#[derive(Debug, Error)]
1211
pub(crate) enum WrappedKeyError {
1312
#[error("failed to deserialize the response payload into JSON: {json_data}")]

openhcl/underhill_attestation/src/key_protector.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use openssl::pkey::Private;
1313
use openssl::rsa::Rsa;
1414
use thiserror::Error;
1515

16-
#[allow(missing_docs)] // self-explanatory fields
1716
#[derive(Debug, Error)]
1817
pub(crate) enum GetKeysFromKeyProtectorError {
1918
#[error(

openhcl/underhill_attestation/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ enum AttestationErrorInner {
7979
ReadGuestSecretKey(#[source] vmgs::ReadFromVmgsError),
8080
}
8181

82-
#[allow(missing_docs)] // self-explanatory fields
8382
#[derive(Debug, Error)]
8483
enum GetDerivedKeysError {
8584
#[error("failed to get ingress/egress keys from the the key protector")]
@@ -114,7 +113,6 @@ enum GetDerivedKeysError {
114113
DeriveEgressKey(#[source] crypto::KbkdfError),
115114
}
116115

117-
#[allow(missing_docs)] // self-explanatory fields
118116
#[derive(Debug, Error)]
119117
enum GetDerivedKeysByIdError {
120118
#[error("failed to derive an egress key based on current vm bios guid")]
@@ -133,7 +131,6 @@ enum GetDerivedKeysByIdError {
133131
},
134132
}
135133

136-
#[allow(missing_docs)] // self-explanatory fields
137134
#[derive(Debug, Error)]
138135
enum UnlockVmgsDataStoreError {
139136
#[error("failed to unlock vmgs with the new ingress key")]
@@ -154,7 +151,6 @@ enum UnlockVmgsDataStoreError {
154151
PersistAllKeyProtectors(#[source] PersistAllKeyProtectorsError),
155152
}
156153

157-
#[allow(missing_docs)] // self-explanatory fields
158154
#[derive(Debug, Error)]
159155
enum PersistAllKeyProtectorsError {
160156
#[error("failed to write key protector to vmgs")]

openhcl/underhill_attestation/src/secure_key_release.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use thiserror::Error;
2121
use vmgs::EncryptionAlgorithm;
2222
use vmgs::Vmgs;
2323

24-
#[allow(missing_docs)] // self-explanatory fields
2524
#[derive(Debug, Error)]
2625
pub(crate) enum RequestVmgsEncryptionKeysError {
2726
#[error("failed to generate an RSA transfer key")]

openhcl/underhill_attestation/src/vmgs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use zerocopy::AsBytes;
1818
use zerocopy::FromBytes;
1919
use zerocopy::FromZeroes;
2020

21-
#[allow(missing_docs)] // self-explanatory fields
2221
#[derive(Debug, Error)]
2322
pub(crate) enum ReadFromVmgsError {
2423
#[error("failed to read {file_id:?} from vmgs")]

openhcl/underhill_core/src/emuplat/tpm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use thiserror::Error;
99
use tpm::ak_cert::RequestAkCert;
1010
use underhill_attestation::AttestationType;
1111

12-
#[allow(missing_docs)] // self-explanatory fields
1312
#[derive(Debug, Error)]
1413
pub enum TpmAttestationError {
1514
#[error("failed to get a hardware attestation report")]

openhcl/underhill_mem/src/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
#![allow(missing_docs)]
4+
#![expect(missing_docs)]
55

66
use crate::mapping::GuestMemoryMapping;
77
use crate::mapping::HardwareIsolatedMemoryProtector;

openhcl/underhill_mem/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ mod mapping {
5858
use x86defs::tdx::TdgMemPageGpaAttr;
5959

6060
/// Error querying vtl permissions on a page
61-
#[allow(missing_docs)]
6261
#[derive(Debug, Error)]
6362
pub enum QueryVtlPermissionsError {
6463
#[error("failed to query rmp permissions")]
@@ -79,7 +78,6 @@ mod mapping {
7978
}
8079

8180
/// Error constructing a [`GuestMemoryMapping`].
82-
#[allow(missing_docs)]
8381
#[derive(Debug, Error)]
8482
pub enum MappingError {
8583
#[error("failed to allocate VA space for guest memory")]

openhcl/virt_mshv_vtl/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ use zerocopy::FromZeroes;
113113

114114
/// General error returned by operations.
115115
#[derive(Error, Debug)]
116-
#[allow(missing_docs)]
116+
#[expect(missing_docs)]
117117
pub enum Error {
118118
#[error("hcl error")]
119119
Hcl(#[source] hcl::ioctl::Error),
@@ -158,7 +158,7 @@ pub enum Error {
158158

159159
/// Error revoking guest VSM.
160160
#[derive(Error, Debug)]
161-
#[allow(missing_docs)]
161+
#[expect(missing_docs)]
162162
pub enum RevokeGuestVsmError {
163163
#[error("failed to set vsm config")]
164164
SetGuestVsmConfig(#[source] hcl::ioctl::SetGuestVsmConfigError),

petri/petri_artifacts_common/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub mod tags {
3232
/// A coarse-grained label used to differentiate between different OS
3333
/// environments.
3434
#[derive(Debug, Clone, Copy)]
35-
#[allow(missing_docs)] // Self-describing names.
35+
#[expect(missing_docs)] // Self-describing names.
3636
pub enum OsFlavor {
3737
Windows,
3838
Linux,
@@ -42,7 +42,7 @@ pub mod tags {
4242

4343
/// The machine architecture supported by the artifact or VM.
4444
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
45-
#[allow(missing_docs)] // Self describing names
45+
#[expect(missing_docs)] // Self describing names
4646
pub enum MachineArch {
4747
X86_64,
4848
Aarch64,

petri/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub const SIZE_1_MB: u64 = 1024 * SIZE_1_KB;
3434
pub const SIZE_1_GB: u64 = 1024 * SIZE_1_MB;
3535

3636
/// The kind of shutdown to perform.
37-
#[allow(missing_docs)] // Self-describing names.
37+
#[expect(missing_docs)] // Self-describing names.
3838
pub enum ShutdownKind {
3939
Shutdown,
4040
Reboot,

support/guid/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use zerocopy::FromZeroes;
2121
mesh(package = "msguid")
2222
)]
2323
#[cfg_attr(feature = "inspect", derive(inspect::Inspect), inspect(display))]
24-
#[allow(missing_docs)]
24+
#[expect(missing_docs)]
2525
pub struct Guid {
2626
#[cfg_attr(feature = "mesh", mesh(1))]
2727
pub data1: u32,
@@ -168,7 +168,7 @@ impl std::fmt::Debug for Guid {
168168

169169
/// An error parsing a GUID.
170170
#[derive(Debug, Error)]
171-
#[allow(missing_docs)]
171+
#[expect(missing_docs)]
172172
pub enum ParseError {
173173
#[error("invalid GUID length")]
174174
Length,

0 commit comments

Comments
 (0)