From 87b299739c74afad6e4d7e631ff6bcd1b39043f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Sun, 28 Jul 2019 20:13:06 -0500 Subject: [PATCH] Make the validation especific to str plugin for now. --- src/plugin.rs | 8 -------- src/plugins/str.rs | 16 ++++++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/plugin.rs b/src/plugin.rs index bbac5d6595..e96fc988f9 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -5,14 +5,6 @@ use std::io; pub trait Plugin { fn config(&mut self) -> Result; - #[allow(unused)] - fn is_valid(&self) -> bool { - true - } - - #[allow(unused)] - fn log_error(&mut self, message: &str) { } - #[allow(unused)] fn begin_filter(&mut self, call_info: CallInfo) -> Result, ShellError> { Ok(vec![]) diff --git a/src/plugins/str.rs b/src/plugins/str.rs index a929def8dd..8c1a68693a 100644 --- a/src/plugins/str.rs +++ b/src/plugins/str.rs @@ -21,6 +21,14 @@ impl Str { } } + fn is_valid(&self) -> bool { + (self.downcase && !self.upcase) || (!self.downcase && self.upcase) + } + + fn log_error(&mut self, message: &str) { + self.error = Some(message.to_string()); + } + fn to_downcase(&mut self) { self.downcase = true; @@ -107,14 +115,6 @@ impl Plugin for Str { }) } - fn is_valid(&self) -> bool { - (self.downcase && !self.upcase) || (!self.downcase && self.upcase) - } - - fn log_error(&mut self, message: &str) { - self.error = Some(message.to_string()); - } - fn begin_filter(&mut self, call_info: CallInfo) -> Result, ShellError> { if call_info.args.has("downcase") { self.to_downcase();