rm: unnecessary MessageText struct
This commit is contained in:
@@ -50,17 +50,6 @@ impl Message {
|
||||
}
|
||||
}
|
||||
|
||||
/// メッセージテキストを言語設定に合わせて返す
|
||||
/// println!("{}", <MessageText>) とすると今の言語設定で出力される
|
||||
impl fmt::Display for MessageText {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match get_lang() {
|
||||
Lang::Ja => write!(f, "{}", self.ja),
|
||||
Lang::En => write!(f, "{}", self.en),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Argsから言語情報を読み取り Lang を返す
|
||||
pub fn get_lang() -> Lang {
|
||||
let lang: String = singleton().args.value_of("lang").unwrap_or("").to_string();
|
||||
|
||||
15
src/main.rs
15
src/main.rs
@@ -5,7 +5,6 @@ use quick_xml::de::DeError;
|
||||
use std::{fs, path::PathBuf, process};
|
||||
use yamato_event_analyzer::detections::configs;
|
||||
use yamato_event_analyzer::detections::detection;
|
||||
use yamato_event_analyzer::detections::print::MESSAGES;
|
||||
use yamato_event_analyzer::omikuji::Omikuji;
|
||||
use yamato_event_analyzer::toml;
|
||||
|
||||
@@ -14,20 +13,6 @@ fn main() -> Result<(), DeError> {
|
||||
let mut toml = toml::ParseToml::new();
|
||||
&toml.read_dir("rules".to_string());
|
||||
|
||||
for rule in toml.rules {
|
||||
match rule {
|
||||
Ok(_rule) => {
|
||||
let mut message = MESSAGES.lock().unwrap();
|
||||
if let Some(messages) = _rule.rule.messages {
|
||||
for (key, texts) in messages {
|
||||
message.insert(key, texts);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => (),
|
||||
}
|
||||
}
|
||||
|
||||
let filepath: String = configs::singleton()
|
||||
.args
|
||||
.value_of("filepath")
|
||||
|
||||
@@ -5,13 +5,7 @@ use serde::Deserialize;
|
||||
pub struct Rule {
|
||||
pub severity: Option<String>,
|
||||
pub name: Option<String>,
|
||||
pub messages: Option<Vec<(String, MessageText)>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct MessageText {
|
||||
pub ja: String,
|
||||
pub en: String,
|
||||
pub messages: Option<Vec<(String, String)>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user