clean: remove .to_string() repetition
This commit is contained in:
parent
883678da8c
commit
85071c7666
|
@ -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))
|
||||
|
|
|
@ -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)),
|
||||
|
|
Loading…
Reference in New Issue
Block a user