mirror of
https://codeberg.org/spire/dispenser.git
synced 2026-06-03 18:14:06 +02:00
clippy
This commit is contained in:
parent
fc54a8faef
commit
7744e93533
4 changed files with 8 additions and 10 deletions
|
|
@ -39,7 +39,7 @@ impl CloudError {
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ResponseError {
|
pub enum ResponseError {
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
JSON(reqwest::Error),
|
Json(reqwest::Error),
|
||||||
#[error("Unexpected response {0}")]
|
#[error("Unexpected response {0}")]
|
||||||
Other(String),
|
Other(String),
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ impl From<reqwest::Error> for NetworkError {
|
||||||
|
|
||||||
impl From<reqwest::Error> for ResponseError {
|
impl From<reqwest::Error> for ResponseError {
|
||||||
fn from(e: reqwest::Error) -> Self {
|
fn from(e: reqwest::Error) -> Self {
|
||||||
ResponseError::JSON(e)
|
ResponseError::Json(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,7 @@ struct VultrCreateResponse {
|
||||||
instance: VultrCreatedInstanceResponse,
|
instance: VultrCreatedInstanceResponse,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct VultrInstanceResponse {
|
struct VultrInstanceResponse {
|
||||||
id: String,
|
id: String,
|
||||||
|
|
@ -264,6 +265,7 @@ struct VultrSshCreateResponse {
|
||||||
ssh_key: VultrSshKeyResponse,
|
ssh_key: VultrSshKeyResponse,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct VultrSshKeyResponse {
|
struct VultrSshKeyResponse {
|
||||||
id: String,
|
id: String,
|
||||||
|
|
|
||||||
10
src/main.rs
10
src/main.rs
|
|
@ -71,14 +71,10 @@ async fn setup(ssh: &mut SshSession, config: &ServerConfig) -> Result<(), Error>
|
||||||
password = config.password,
|
password = config.password,
|
||||||
rcon = config.rcon,
|
rcon = config.rcon,
|
||||||
demostf = config
|
demostf = config
|
||||||
.demostf_key
|
.demostf_key.as_deref()
|
||||||
.as_ref()
|
|
||||||
.map(String::as_str)
|
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
logstf = config
|
logstf = config
|
||||||
.logstf_key
|
.logstf_key.as_deref()
|
||||||
.as_ref()
|
|
||||||
.map(String::as_str)
|
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
league = config.config_league,
|
league = config.config_league,
|
||||||
mode = config.config_mode,
|
mode = config.config_mode,
|
||||||
|
|
@ -177,7 +173,7 @@ async fn run_loop(
|
||||||
if stop {
|
if stop {
|
||||||
let id = &active_server.as_ref().unwrap().id;
|
let id = &active_server.as_ref().unwrap().id;
|
||||||
println!("Stopping server {}", id);
|
println!("Stopping server {}", id);
|
||||||
match cloud.kill(&id).await {
|
match cloud.kill(id).await {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
active_server = None;
|
active_server = None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ impl SshSession {
|
||||||
while let Some(msg) = channel.wait().await {
|
while let Some(msg) = channel.wait().await {
|
||||||
match msg {
|
match msg {
|
||||||
thrussh::ChannelMsg::Data { ref data } => {
|
thrussh::ChannelMsg::Data { ref data } => {
|
||||||
output.write_all(&data).unwrap();
|
output.write_all(data).unwrap();
|
||||||
}
|
}
|
||||||
thrussh::ChannelMsg::ExitStatus { exit_status } => {
|
thrussh::ChannelMsg::ExitStatus { exit_status } => {
|
||||||
code = Some(exit_status);
|
code = Some(exit_status);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue