From d2d0eed5578e6453bafe4a803af87b9743b77aca Mon Sep 17 00:00:00 2001 From: oluceps Date: Sun, 3 Nov 2024 22:16:43 +0800 Subject: [PATCH] ~ clean --- src/cmd/renc.rs | 6 +++--- src/helper/parse_identity.rs | 18 +++--------------- src/interop/mod.rs | 2 +- src/profile.rs | 3 ++- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/cmd/renc.rs b/src/cmd/renc.rs index 3712603..a49a169 100644 --- a/src/cmd/renc.rs +++ b/src/cmd/renc.rs @@ -1,10 +1,10 @@ use eyre::{eyre, ContextCompat, Result}; -use spdlog::{debug, error, info, trace}; -use std::{collections::HashMap, fs, iter, path::PathBuf}; +use spdlog::{error, info}; +use std::{fs, path::PathBuf}; use crate::helper::stored::{SecMap, SumPath}; +use crate::interop::add_to_store; use crate::profile::{MasterIdentity, Profile}; -use crate::{interop::add_to_store, profile}; use crate::helper::parse_identity::ParsedIdentity; impl Profile { diff --git a/src/helper/parse_identity.rs b/src/helper/parse_identity.rs index 25fc14a..912defc 100644 --- a/src/helper/parse_identity.rs +++ b/src/helper/parse_identity.rs @@ -1,27 +1,15 @@ -use std::{fs, str::FromStr}; - use crate::profile::MasterIdentity; -use age::{x25519, Identity, IdentityFile, Recipient}; +use age::{Identity, IdentityFile, Recipient}; use eyre::{eyre, ContextCompat, Result}; -use spdlog::{debug, error, info}; use super::callback::UiCallbacks; +#[allow(dead_code)] pub struct ParsedIdentity { identity: Box, recipient: Box, } impl ParsedIdentity { - // pub fn new(identity: I, recipient: R) -> Self - // where - // I: Identity + 'static, - // R: Recipient + 'static, - // { - // Self { - // identity: Box::new(identity), - // recipient: Box::new(recipient), - // } - // } pub fn from_exist(identity: Box, recipient: Box) -> Self { Self { identity, @@ -31,7 +19,7 @@ impl ParsedIdentity { pub fn get_identity(&self) -> &Box { &self.identity } - pub fn get_recipient(&self) -> &Box { + pub fn _get_recipient(&self) -> &Box { &self.recipient } } diff --git a/src/interop/mod.rs b/src/interop/mod.rs index 76673ad..90877df 100644 --- a/src/interop/mod.rs +++ b/src/interop/mod.rs @@ -3,7 +3,7 @@ use std::{ process::{Command, Output}, }; -use eyre::{eyre, Context, Result}; +use eyre::{eyre, Result}; pub fn add_to_store>(p: P) -> Result { Command::new("nix") diff --git a/src/profile.rs b/src/profile.rs index 9635aa6..c0ed5ec 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -1,4 +1,3 @@ -use eyre::Result; use std::collections::HashMap; use serde::Deserialize; @@ -29,6 +28,7 @@ pub struct Settings { pub decrypted_dir: String, pub decrypted_mount_point: String, pub host_identifier: String, + #[allow(dead_code)] pub extra_recipients: Vec, pub host_pubkey: String, pub host_keys: Vec, @@ -40,6 +40,7 @@ pub struct Settings { #[derive(Debug, Deserialize)] pub struct MasterIdentity { pub identity: String, + #[allow(dead_code)] pub pubkey: String, } #[derive(Debug, Deserialize)]