Skip to content

Commit

Permalink
clippy: eliminate warnings & errors
Browse files Browse the repository at this point in the history
Signed-off-by: Erdem Meydanli <[email protected]>
  • Loading branch information
meerd committed Mar 19, 2024
1 parent 233dced commit f710d3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
9 changes: 2 additions & 7 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ const SOCKETS_DIR_PATH: &str = "/run/nitro_enclaves";
const BACKTRACE_VAR: &str = "BACKTRACE";

/// All possible errors which may occur.
#[derive(Debug, Clone, Copy, Hash, PartialEq)]
#[derive(Debug, Default, Clone, Copy, Hash, PartialEq)]
pub enum NitroCliErrorEnum {
#[default]
/// Unspecified error (should avoid using it thoughout the code).
UnspecifiedError = 0,
/// Error for handling missing arguments.
Expand Down Expand Up @@ -180,12 +181,6 @@ pub enum NitroCliErrorEnum {
EIFSignatureCheckerError,
}

impl Default for NitroCliErrorEnum {
fn default() -> NitroCliErrorEnum {
NitroCliErrorEnum::UnspecifiedError
}
}

impl Eq for NitroCliErrorEnum {}

/// The type of commands that can be sent to an enclave process.
Expand Down
1 change: 0 additions & 1 deletion src/enclave_proc/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use std::collections::HashMap;
use std::io::Write;
use std::os::unix::io::AsRawFd;
use std::os::unix::net::UnixStream;
use std::string::ToString;
use std::sync::{Arc, Mutex};

use crate::common::{receive_from_stream, write_u64_le};
Expand Down
10 changes: 2 additions & 8 deletions src/enclave_proc/resource_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use eif_loader::{enclave_ready, TIMEOUT_MINUTE_MS};
use libc::c_int;
use log::{debug, info};
use std::collections::BTreeMap;
use std::convert::{From, Into};
use std::fs::{File, OpenOptions};
use std::io::prelude::*;
use std::io::Error;
Expand Down Expand Up @@ -109,8 +108,9 @@ pub struct MemoryRegion {
}

/// The state an enclave may be in.
#[derive(Clone)]
#[derive(Clone, Default)]
pub enum EnclaveState {
#[default]
/// The enclave is not running (it's either not started or has been terminated).
Empty,
/// The enclave is running.
Expand Down Expand Up @@ -180,12 +180,6 @@ impl ToString for EnclaveState {
}
}

impl Default for EnclaveState {
fn default() -> Self {
EnclaveState::Empty
}
}

impl Default for EnclaveBuildInfo {
fn default() -> Self {
EnclaveBuildInfo::new(BTreeMap::new())
Expand Down

0 comments on commit f710d3d

Please sign in to comment.