clean: remove .to_string() repetition

This commit is contained in:
realaltffour 2020-07-30 12:56:12 +03:00
parent 883678da8c
commit 85071c7666
No known key found for this signature in database
GPG Key ID: C1265D839D44DCB1
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ pub fn create_company(state: &mut GlobalState, company: Company) -> Result<(), S
&company.primary_sic_code, &company.employees]) {
Ok(_row) => {
// add company to state
state.companies.insert(company.symbol.to_string(), company);
state.companies.insert(company.symbol.into(), company);
Ok(())
},
Err(error) => Err(format!("CMD_COMPANY_CREATE_FAILED: {}", error))

View File

@ -31,7 +31,7 @@ pub fn get_company_from_db(state: &mut GlobalState, searched_symbol: String) ->
match state.companies.get(&searched_symbol) {
Some(company) => Ok(company),
None => Err("DB_SEARCH_COMPANY_NOT_FOUND".to_string())
None => Err("DB_SEARCH_COMPANY_NOT_FOUND".into())
}
},
Err(err) => Err(format!("DB_SEARCH_COMPANY_NOT_FOUND: {}", err)),