fixed clippy error

This commit is contained in:
DustInDark
2022-06-07 19:42:41 +09:00
parent c3f31c4ac2
commit eded81e39b

View File

@@ -1,4 +1,4 @@
use crate::detections::{configs, detection::EvtxRecordInfo}; use crate::detections::{configs::CONFIG, detection::EvtxRecordInfo};
use prettytable::{Cell, Row, Table}; use prettytable::{Cell, Row, Table};
use super::statistics::EventStatistics; use super::statistics::EventStatistics;
@@ -35,11 +35,7 @@ impl Timeline {
} }
pub fn tm_stats_dsp_msg(&mut self) { pub fn tm_stats_dsp_msg(&mut self) {
let statics_flag = configs::CONFIG let statics_flag = CONFIG.read().unwrap().args.is_present("statistics");
.read()
.unwrap()
.args
.is_present("statistics");
if !statics_flag { if !statics_flag {
return; return;
} }
@@ -70,11 +66,7 @@ impl Timeline {
} }
pub fn tm_logon_stats_dsp_msg(&mut self) { pub fn tm_logon_stats_dsp_msg(&mut self) {
let logon_summary_flag = configs::CONFIG let logon_summary_flag = CONFIG.read().unwrap().args.is_present("logon-summary");
.read()
.unwrap()
.args
.is_present("logon-summary");
if !logon_summary_flag { if !logon_summary_flag {
return; return;
} }
@@ -102,20 +94,29 @@ impl Timeline {
let rate: f32 = **event_cnt as f32 / self.stats.total as f32; let rate: f32 = **event_cnt as f32 / self.stats.total as f32;
// イベント情報取得(eventtitleなど) // イベント情報取得(eventtitleなど)
let conf = configs::CONFIG.read().unwrap(); let conf = CONFIG
.read()
.unwrap()
.event_timeline_config
.get_event_id(*event_id)
.is_some();
// statistics_event_info.txtに登録あるものは情報設定 // statistics_event_info.txtに登録あるものは情報設定
match conf.event_timeline_config.get_event_id(*event_id) { if conf {
Some(e) => {
// 出力メッセージ1行作成 // 出力メッセージ1行作成
msges.push(format!( msges.push(format!(
"{0} ({1:.1}%)\t{2}\t{3}", "{0} ({1:.1}%)\t{2}\t{3}",
event_cnt, event_cnt,
(rate * 1000.0).round() / 10.0, (rate * 1000.0).round() / 10.0,
event_id, event_id,
e.evttitle, &CONFIG
.read()
.unwrap()
.event_timeline_config
.get_event_id(*event_id)
.unwrap()
.evttitle,
)); ));
} } else {
None => {
// 出力メッセージ1行作成 // 出力メッセージ1行作成
msges.push(format!( msges.push(format!(
"{0} ({1:.1}%)\t{2}\t{3}", "{0} ({1:.1}%)\t{2}\t{3}",
@@ -126,7 +127,7 @@ impl Timeline {
)); ));
} }
} }
}
msges.push("---------------------------------------".to_string()); msges.push("---------------------------------------".to_string());
msges msges
} }