linted the code.

This commit is contained in:
didier amyot committed 2023-02-25 22:10:18 -05:00
1 parent 0c171171c2
commit f4170610b0
12 files changed
+84 -57

No files matched your search

+10 -12
View File
@@ -10,21 +10,19 @@ pub struct CreateNewSecurity {
}
impl CreateNewSecurity {
fn get_security_type(&self) -> Option<SecurityType>{
fn get_security_type(&self) -> Option<SecurityType> {
SecurityType::from_string(self.security_type.clone())
}
pub fn to_create_new_security(&self) -> Option<NewSecurity> {
self.get_security_type()
.map(|security_type|
NewSecurity {
security_type,
symbol: self.symbol.clone(),
name: self.name.clone(),
})
self.get_security_type().map(|security_type| NewSecurity {
security_type,
symbol: self.symbol.clone(),
name: self.name.clone(),
})
}
fn validate_event(&self) -> Result<(), String>{
if SecurityType::from_string(self.security_type.clone()).is_none(){
fn validate_event(&self) -> Result<(), String> {
if SecurityType::from_string(self.security_type.clone()).is_none() {
Err(format!("Invalid SecurityType \"{}\".", self.security_type))
} else {
Ok(())
@@ -45,10 +43,10 @@ pub enum Event {
}
impl Event {
pub fn validate_event(&self) -> Result<(), String>{
pub fn validate_event(&self) -> Result<(), String> {
match self {
Event::CreateNewSecurity(event) => event.validate_event(),
_ => Ok(()),
}
}
}
}