From 27e617c68ec7bc3ac258008ffcbeadd46e467f5b Mon Sep 17 00:00:00 2001 From: Ovidiu Stinga Date: Tue, 4 Jul 2023 17:36:00 +0300 Subject: [PATCH] fix clippy issues --- vm/src/tx_execution/system_sc/system_sc_issue.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/vm/src/tx_execution/system_sc/system_sc_issue.rs b/vm/src/tx_execution/system_sc/system_sc_issue.rs index 666d44678f..cb9c0fcea9 100644 --- a/vm/src/tx_execution/system_sc/system_sc_issue.rs +++ b/vm/src/tx_execution/system_sc/system_sc_issue.rs @@ -93,21 +93,16 @@ pub fn issue_non_fungible(tx_context: TxContext) -> (TxContext, TxResult) { } fn first_token_identifier_with_ticker( - token_identifiers: &Vec, + token_identifiers: &[String], ticker: &[u8], ) -> Option<(usize, String)> { let extract_ticker = - |ti: &String| -> String { ti.split("-").map(|x| x.to_string()).next().unwrap() }; + |ti: &String| -> String { ti.split('-').map(|x| x.to_string()).next().unwrap() }; - let position = token_identifiers + token_identifiers .iter() - .position(|x| extract_ticker(x).as_bytes() == ticker); - - if let Some(i) = position { - Some((i, token_identifiers[i].clone())) - } else { - None - } + .position(|x| extract_ticker(x).as_bytes() == ticker) + .map(|i| (i, token_identifiers[i].clone())) } fn generate_token_identifier_from_ticker(