Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tzskp1 committed Dec 6, 2024
1 parent 2ea2e05 commit d1bd524
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 5 deletions.
7 changes: 6 additions & 1 deletion agent/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl SingletonAppConfig {
}
}

#[allow(static_mut_refs)]
pub fn app_config() -> Box<SingletonAppConfig> {
static mut SINGLETON: Option<Box<SingletonAppConfig>> = None;
static ONCE: Once = Once::new();
Expand Down Expand Up @@ -147,7 +148,11 @@ fn load_key_pair<U, V, T: KeyPair<U, V>>(kind: &Option<KeyPairHex>) -> Option<T>

impl AppConfig {
fn touch(path: &Path) -> io::Result<()> {
let mut file = OpenOptions::new().create(true).write(true).open(path)?;
let mut file = OpenOptions::new()
.truncate(true)
.create(true)
.write(true)
.open(path)?;
file.write_all(b"{}")?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion agent/src/controllers/internal/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct MessageContainer {

pub async fn handler_get(_req: HttpRequest) -> actix_web::Result<HttpResponse> {
let current_version = env!("CARGO_PKG_VERSION");
Ok(HttpResponse::Ok().json(&json!({ "version": current_version })))
Ok(HttpResponse::Ok().json(json!({ "version": current_version })))
}

pub async fn handler_update(
Expand Down
1 change: 1 addition & 0 deletions agent/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub enum Command {
Send { value: Value, resp: Responder },
}

#[allow(dead_code)]
#[trait_variant::make(Send)]
pub trait TransferClient: Sync {
async fn send(&self, value: Value) -> anyhow::Result<bool>;
Expand Down
1 change: 0 additions & 1 deletion agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ shadow!(build);

#[derive(Parser, Debug)]
#[clap(name = "nodex-agent")]
#[clap(name = "nodex-agent")]
#[clap(
version = shadow_rs::formatcp!("v{} ({} {})\n{} @ {}", build::PKG_VERSION, build::SHORT_COMMIT, build::BUILD_TIME_3339, build::RUST_VERSION, build::BUILD_TARGET),
about,
Expand Down
7 changes: 6 additions & 1 deletion agent/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ impl SingletonNetworkConfig {
}
}

#[allow(static_mut_refs)]
pub fn network_config() -> Box<SingletonNetworkConfig> {
static mut SINGLETON: Option<Box<SingletonNetworkConfig>> = None;
static ONCE: Once = Once::new();
Expand Down Expand Up @@ -58,7 +59,11 @@ pub struct Network {

impl Network {
fn touch(path: &Path) -> io::Result<()> {
let mut file = OpenOptions::new().create(true).write(true).open(path)?;
let mut file = OpenOptions::new()
.truncate(true)
.create(true)
.write(true)
.open(path)?;
file.write_all(b"{}")?;
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions agent/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use actix_web::{dev::Server, middleware, web, App, HttpServer};
use std::path::PathBuf;
use tokio::sync::Mutex as TokioMutex;

#[allow(dead_code)]
pub struct Context<C: TransferClient> {
pub sender: TokioMutex<C>,
}
Expand Down
3 changes: 2 additions & 1 deletion agent/src/services/nodex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ impl NodeX {
daemonize.start().expect("Failed to update nodex process");
std::process::Command::new(agent_path)
.spawn()
.expect("Failed to execute command");
.expect("Failed to execute command")
.wait()?;
Ok(())
}

Expand Down

0 comments on commit d1bd524

Please sign in to comment.