Skip to content

Commit b941fa4

Browse files
authored
Merge pull request #435 from Dstack-TEE/fix-clippy
Fix clippy errors
2 parents 562d597 + ed4f9dd commit b941fa4

File tree

10 files changed

+10
-76
lines changed

10 files changed

+10
-76
lines changed

cert-client/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tdx_attest::{eventlog::read_event_logs, get_quote};
1515

1616
pub enum CertRequestClient {
1717
Local {
18-
ca: CaCert,
18+
ca: Box<CaCert>,
1919
},
2020
Kms {
2121
client: KmsClient<RaClient>,
@@ -66,7 +66,7 @@ impl CertRequestClient {
6666
KeyProvider::None { key } | KeyProvider::Local { key, .. } => {
6767
let ca = CaCert::new(keys.ca_cert.clone(), key.clone())
6868
.context("Failed to create CA")?;
69-
Ok(CertRequestClient::Local { ca })
69+
Ok(CertRequestClient::Local { ca: Box::new(ca) })
7070
}
7171
KeyProvider::Kms {
7272
url,

dstack-util/src/main.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use ra_tls::{
1717
kdf::{derive_ecdsa_key, derive_ecdsa_key_pair_from_bytes},
1818
rcgen::KeyPair,
1919
};
20-
use scale::Decode;
2120
use serde::Deserialize;
2221
use std::{collections::HashMap, path::Path};
2322
use std::{
@@ -237,41 +236,6 @@ fn cmd_rand(rand_args: RandArgs) -> Result<()> {
237236
Ok(())
238237
}
239238

240-
#[derive(Decode)]
241-
struct ParsedReport {
242-
attributes: [u8; 8],
243-
xfam: [u8; 8],
244-
mrtd: [u8; 48],
245-
mrconfigid: [u8; 48],
246-
mrowner: [u8; 48],
247-
mrownerconfig: [u8; 48],
248-
rtmr0: [u8; 48],
249-
rtmr1: [u8; 48],
250-
rtmr2: [u8; 48],
251-
rtmr3: [u8; 48],
252-
servtd_hash: [u8; 48],
253-
}
254-
255-
impl core::fmt::Debug for ParsedReport {
256-
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
257-
use hex_fmt::HexFmt as HF;
258-
259-
f.debug_struct("ParsedReport")
260-
.field("attributes", &HF(&self.attributes))
261-
.field("xfam", &HF(&self.xfam))
262-
.field("mrtd", &HF(&self.mrtd))
263-
.field("mrconfigid", &HF(&self.mrconfigid))
264-
.field("mrowner", &HF(&self.mrowner))
265-
.field("mrownerconfig", &HF(&self.mrownerconfig))
266-
.field("rtmr0", &HF(&self.rtmr0))
267-
.field("rtmr1", &HF(&self.rtmr1))
268-
.field("rtmr2", &HF(&self.rtmr2))
269-
.field("rtmr3", &HF(&self.rtmr3))
270-
.field("servtd_hash", &HF(&self.servtd_hash))
271-
.finish()
272-
}
273-
}
274-
275239
fn cmd_show_mrs() -> Result<()> {
276240
let attestation =
277241
ra_tls::attestation::Attestation::local().context("Failed to get attestation")?;

gateway/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async fn maybe_gen_certs(config: &Config, tls_config: &TlsConfig) -> Result<()>
106106
let cert = ra_tls::cert::CertRequest::builder()
107107
.key(&key)
108108
.subject("dstack-gateway")
109-
.alt_names(&[config.rpc_domain.clone()])
109+
.alt_names(std::slice::from_ref(&config.rpc_domain))
110110
.usage_server_auth(true)
111111
.build()
112112
.self_signed()

gateway/src/main_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Proxy {
100100
}
101101

102102
impl ProxyInner {
103-
pub(crate) fn lock(&self) -> MutexGuard<ProxyState> {
103+
pub(crate) fn lock(&self) -> MutexGuard<'_, ProxyState> {
104104
self.state.lock().or_panic("Failed to lock AppState")
105105
}
106106

gateway/src/proxy/sni.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn extract_sni(b: &[u8]) -> Option<&[u8]> {
1010
extract_sni_inner(b).ok().map(|r| r.1)
1111
}
1212

13-
fn extract_sni_inner(b: &[u8]) -> Result<(usize, &[u8]), PErr<u8>> {
13+
fn extract_sni_inner(b: &[u8]) -> Result<(usize, &[u8]), PErr<'_, u8>> {
1414
const HANDSHAKE_TYPE_CLIENT_HELLO: usize = 1;
1515
const EXTENSION_TYPE_SNI: usize = 0;
1616
const NAME_TYPE_HOST_NAME: usize = 0;

serde-duration/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ where
1212
if duration == &Duration::MAX {
1313
return serializer.serialize_str("never");
1414
}
15-
let (value, unit) = if duration.as_secs() % (24 * 3600) == 0 {
15+
let (value, unit) = if duration.as_secs().is_multiple_of(24 * 3600) {
1616
(duration.as_secs() / (24 * 3600), "d")
17-
} else if duration.as_secs() % 3600 == 0 {
17+
} else if duration.as_secs().is_multiple_of(3600) {
1818
(duration.as_secs() / 3600, "h")
19-
} else if duration.as_secs() % 60 == 0 {
19+
} else if duration.as_secs().is_multiple_of(60) {
2020
(duration.as_secs() / 60, "m")
2121
} else {
2222
(duration.as_secs(), "s")

supervisor/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl Process {
167167
}
168168
}
169169

170-
pub(crate) fn lock(&self) -> MutexGuard<ProcessStateRT> {
170+
pub(crate) fn lock(&self) -> MutexGuard<'_, ProcessStateRT> {
171171
self.state.lock().or_panic("lock should never fail")
172172
}
173173

verifier/src/types.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,3 @@ pub enum RtmrEventStatus {
7373
Extra,
7474
Missing,
7575
}
76-
77-
#[derive(Debug, Clone, Serialize, Deserialize)]
78-
pub struct ErrorResponse {
79-
pub error: String,
80-
pub details: Option<String>,
81-
}

verifier/src/verification.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -760,27 +760,3 @@ impl Mrs {
760760
Ok(())
761761
}
762762
}
763-
764-
mod upgrade_authority {
765-
use serde::{Deserialize, Serialize};
766-
767-
#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
768-
pub struct BootInfo {
769-
pub mrtd: Vec<u8>,
770-
pub rtmr0: Vec<u8>,
771-
pub rtmr1: Vec<u8>,
772-
pub rtmr2: Vec<u8>,
773-
pub rtmr3: Vec<u8>,
774-
pub mr_aggregated: Vec<u8>,
775-
pub os_image_hash: Vec<u8>,
776-
pub mr_system: Vec<u8>,
777-
pub app_id: Vec<u8>,
778-
pub compose_hash: Vec<u8>,
779-
pub instance_id: Vec<u8>,
780-
pub device_id: Vec<u8>,
781-
pub key_provider_info: Vec<u8>,
782-
pub event_log: String,
783-
pub tcb_status: String,
784-
pub advisory_ids: Vec<String>,
785-
}
786-
}

vmm/src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub struct App {
123123
}
124124

125125
impl App {
126-
fn lock(&self) -> MutexGuard<AppState> {
126+
fn lock(&self) -> MutexGuard<'_, AppState> {
127127
self.state.lock().or_panic("mutex poisoned")
128128
}
129129

0 commit comments

Comments
 (0)