Skip to content

Commit

Permalink
remove format! call, refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
TropicalDog17 committed Jul 30, 2024
1 parent 2c9a37d commit 22febc3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions near-sdk-macros/src/core_impl/code_generator/attr_sig_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ impl AttrSigInfo {
let ArgInfo { mutability, ident, ty, bindgen_ty, serializer_ty, .. } = arg;
match &bindgen_ty {
BindgenArgType::CallbackArg => {
let error_msg = format!("Callback computation {} was not successful", idx);
let read_data = quote! {
let data: ::std::vec::Vec<u8> = match ::near_sdk::env::promise_result(#idx) {
::near_sdk::PromiseResult::Successful(x) => x,
_ => ::near_sdk::env::panic_str(#error_msg)

_ => ::near_sdk::env::panic_str(concat!("Callback computation ", stringify!(i), " was not successful")),

};
};
let invocation = deserialize_data(serializer_ty);
Expand Down Expand Up @@ -298,7 +299,7 @@ impl AttrSigInfo {
|i| {
let data: ::std::vec::Vec<u8> = match ::near_sdk::env::promise_result(i) {
::near_sdk::PromiseResult::Successful(x) => x,
_ => ::near_sdk::env::panic_str(&::std::format!("Callback computation {} was not successful", i)),
_ => ::near_sdk::env::panic_str(concat!("Callback computation ", stringify!(i), " was not successful")),
};
#invocation
}));
Expand Down

0 comments on commit 22febc3

Please sign in to comment.