Linting
This commit is contained in:
parent
4e879c35a6
commit
8c61eac586
@ -1,7 +1,7 @@
|
||||
use crate::{handlers::{self, minecraft::Minecraft}, types::ServerInfo};
|
||||
use crate::{handlers, types::ServerInfo};
|
||||
use anyhow::anyhow;
|
||||
use serde::Deserialize;
|
||||
use std::{error::Error, fmt::Display, fs::File, path::Path};
|
||||
use std::{fs::File, path::Path};
|
||||
|
||||
const SCHEMA_VERSION: &str = "0.2.0";
|
||||
|
||||
@ -13,7 +13,7 @@ pub enum ConfigEntry {
|
||||
impl ConfigEntry {
|
||||
pub fn inner(&self) -> impl ServerInfo {
|
||||
match self {
|
||||
ConfigEntry::Minecraft(mc) => mc.clone()
|
||||
ConfigEntry::Minecraft(mc) => mc.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,10 @@ pub fn parse_configs(path: &Path) -> Result<Config, anyhow::Error> {
|
||||
let file_handle = File::open(path)?;
|
||||
let config = serde_json::from_reader::<File, Config>(file_handle)?;
|
||||
if !(SCHEMA_VERSION == config.version) {
|
||||
return Err(anyhow!(format!("Expected schema version {}, found {}", SCHEMA_VERSION, config.version)));
|
||||
return Err(anyhow!(format!(
|
||||
"Expected schema version {}, found {}",
|
||||
SCHEMA_VERSION, config.version
|
||||
)));
|
||||
}
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
@ -4,10 +4,9 @@ mod handlers;
|
||||
mod request;
|
||||
mod types;
|
||||
|
||||
use env_logger;
|
||||
use log::*;
|
||||
use crate::bot_runner::BotRunner;
|
||||
use futures::{self, future::try_join_all};
|
||||
use log::*;
|
||||
use std::path::Path;
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@ -6,6 +6,9 @@ const USER_AGENT: &str = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36
|
||||
pub async fn request(url: Url) -> Result<Response, reqwest::Error> {
|
||||
let client = reqwest::Client::new();
|
||||
let mut request = reqwest::Request::new(reqwest::Method::GET, url);
|
||||
request.headers_mut().append("User-Agent", HeaderValue::from_str(USER_AGENT).expect("Could not build header"));
|
||||
request.headers_mut().append(
|
||||
"User-Agent",
|
||||
HeaderValue::from_str(USER_AGENT).expect("Could not build header"),
|
||||
);
|
||||
client.execute(request).await
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user