Просмотр исходного кода

Fix clippy lint issues

develop
Silvestr Predko 2 лет назад
Родитель
Сommit
c0ab3cac7b

+ 2
- 2
common-api/src/crypto/mod.rs Просмотреть файл

@@ -170,10 +170,10 @@ mod tests {
170 170
     fn split_encoded() {
171 171
         let bs58_str = bs58::encode(vec![0, 0, 0]).into_string();
172 172
         assert!(matches!(
173
-                split_encoded_str(&format!("ed25519:{}", bs58_str)),
173
+                split_encoded_str(&format!("ed25519:{bs58_str}")),
174 174
                 Ok((key_type, s)) if key_type == ED25519 && s == bs58_str));
175 175
         assert!(matches!(
176
-                split_encoded_str(&format!("x25519:{}", bs58_str)),
176
+                split_encoded_str(&format!("x25519:{bs58_str}")),
177 177
                 Ok((key_type, s)) if key_type == X25519 && s == bs58_str));
178 178
         assert!(matches!(
179 179
             split_encoded_str(&bs58_str),

+ 60
- 90
near-primitives-light/src/errors.rs Просмотреть файл

@@ -25,8 +25,8 @@ impl std::error::Error for TxExecutionError {}
25 25
 impl Display for TxExecutionError {
26 26
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
27 27
         match self {
28
-            TxExecutionError::ActionError(e) => write!(f, "{}", e),
29
-            TxExecutionError::InvalidTxError(e) => write!(f, "{}", e),
28
+            TxExecutionError::ActionError(e) => write!(f, "{e}"),
29
+            TxExecutionError::InvalidTxError(e) => write!(f, "{e}"),
30 30
         }
31 31
     }
32 32
 }
@@ -64,7 +64,7 @@ pub enum RuntimeError {
64 64
 
65 65
 impl std::fmt::Display for RuntimeError {
66 66
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
67
-        f.write_str(&format!("{:?}", self))
67
+        f.write_str(&format!("{self:?}"))
68 68
     }
69 69
 }
70 70
 
@@ -89,7 +89,7 @@ pub enum StorageError {
89 89
 
90 90
 impl std::fmt::Display for StorageError {
91 91
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
92
-        f.write_str(&format!("{:?}", self))
92
+        f.write_str(&format!("{self:?}"))
93 93
     }
94 94
 }
95 95
 
@@ -232,30 +232,27 @@ impl Display for ReceiptValidationError {
232 232
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
233 233
         match self {
234 234
             ReceiptValidationError::InvalidPredecessorId { account_id } => {
235
-                write!(f, "The predecessor_id `{}` of a Receipt is not valid.", account_id)
235
+                write!(f, "The predecessor_id `{account_id}` of a Receipt is not valid.")
236 236
             }
237 237
             ReceiptValidationError::InvalidReceiverId { account_id } => {
238
-                write!(f, "The receiver_id `{}` of a Receipt is not valid.", account_id)
238
+                write!(f, "The receiver_id `{account_id}` of a Receipt is not valid.")
239 239
             }
240 240
             ReceiptValidationError::InvalidSignerId { account_id } => {
241
-                write!(f, "The signer_id `{}` of an ActionReceipt is not valid.", account_id)
241
+                write!(f, "The signer_id `{account_id}` of an ActionReceipt is not valid.")
242 242
             }
243 243
             ReceiptValidationError::InvalidDataReceiverId { account_id } => write!(
244 244
                 f,
245
-                "The receiver_id `{}` of a DataReceiver within an ActionReceipt is not valid.",
246
-                account_id
245
+                "The receiver_id `{account_id}` of a DataReceiver within an ActionReceipt is not valid."
247 246
             ),
248 247
             ReceiptValidationError::ReturnedValueLengthExceeded { length, limit } => write!(
249 248
                 f,
250
-                "The length of the returned data {} exceeded the limit {} in a DataReceipt",
251
-                length, limit
249
+                "The length of the returned data {length} exceeded the limit {limit} in a DataReceipt"
252 250
             ),
253 251
             ReceiptValidationError::NumberInputDataDependenciesExceeded { number_of_input_data_dependencies, limit } => write!(
254 252
                 f,
255
-                "The number of input data dependencies {} exceeded the limit {} in an ActionReceipt",
256
-                number_of_input_data_dependencies, limit
253
+                "The number of input data dependencies {number_of_input_data_dependencies} exceeded the limit {limit} in an ActionReceipt"
257 254
             ),
258
-            ReceiptValidationError::ActionsValidation(e) => write!(f, "{}", e),
255
+            ReceiptValidationError::ActionsValidation(e) => write!(f, "{e}"),
259 256
         }
260 257
     }
261 258
 }
@@ -269,24 +266,21 @@ impl Display for ActionsValidationError {
269 266
                 write!(f, "The delete action must be the last action in transaction")
270 267
             }
271 268
             ActionsValidationError::TotalPrepaidGasExceeded { total_prepaid_gas, limit } => {
272
-                write!(f, "The total prepaid gas {} exceeds the limit {}", total_prepaid_gas, limit)
269
+                write!(f, "The total prepaid gas {total_prepaid_gas} exceeds the limit {limit}")
273 270
             }
274 271
             ActionsValidationError::TotalNumberOfActionsExceeded {total_number_of_actions, limit } => {
275 272
                 write!(
276 273
                     f,
277
-                    "The total number of actions {} exceeds the limit {}",
278
-                    total_number_of_actions, limit
274
+                    "The total number of actions {total_number_of_actions} exceeds the limit {limit}"
279 275
                 )
280 276
             }
281 277
             ActionsValidationError::AddKeyMethodNamesNumberOfBytesExceeded { total_number_of_bytes, limit } => write!(
282 278
                 f,
283
-                "The total number of bytes in allowed method names {} exceeds the maximum allowed number {} in a AddKey action",
284
-                total_number_of_bytes, limit
279
+                "The total number of bytes in allowed method names {total_number_of_bytes} exceeds the maximum allowed number {limit} in a AddKey action"
285 280
             ),
286 281
             ActionsValidationError::AddKeyMethodNameLengthExceeded { length, limit } => write!(
287 282
                 f,
288
-                "The length of some method name {} exceeds the maximum allowed length {} in a AddKey action",
289
-                length, limit
283
+                "The length of some method name {length} exceeds the maximum allowed length {limit} in a AddKey action"
290 284
             ),
291 285
             ActionsValidationError::IntegerOverflow => write!(
292 286
                 f,
@@ -294,28 +288,23 @@ impl Display for ActionsValidationError {
294 288
             ),
295 289
             ActionsValidationError::InvalidAccountId { account_id } => write!(
296 290
                 f,
297
-                "Invalid account ID `{}`",
298
-                account_id
291
+                "Invalid account ID `{account_id}`"
299 292
             ),
300 293
             ActionsValidationError::ContractSizeExceeded { size, limit } => write!(
301 294
                 f,
302
-                "The length of the contract size {} exceeds the maximum allowed size {} in a DeployContract action",
303
-                size, limit
295
+                "The length of the contract size {size} exceeds the maximum allowed size {limit} in a DeployContract action"
304 296
             ),
305 297
             ActionsValidationError::FunctionCallMethodNameLengthExceeded { length, limit } => write!(
306 298
                 f,
307
-                "The length of the method name {} exceeds the maximum allowed length {} in a FunctionCall action",
308
-                length, limit
299
+                "The length of the method name {length} exceeds the maximum allowed length {limit} in a FunctionCall action"
309 300
             ),
310 301
             ActionsValidationError::FunctionCallArgumentsLengthExceeded { length, limit } => write!(
311 302
                 f,
312
-                "The length of the arguments {} exceeds the maximum allowed length {} in a FunctionCall action",
313
-                length, limit
303
+                "The length of the arguments {length} exceeds the maximum allowed length {limit} in a FunctionCall action"
314 304
             ),
315 305
             ActionsValidationError::UnsuitableStakingKey { public_key } => write!(
316 306
                 f,
317
-                "The staking key must be ristretto compatible ED25519 key. {} is provided instead.",
318
-                public_key,
307
+                "The staking key must be ristretto compatible ED25519 key. {public_key} is provided instead."
319 308
             ),
320 309
             ActionsValidationError::FunctionCallZeroAttachedGas => write!(
321 310
                 f,
@@ -429,26 +418,23 @@ impl Display for InvalidTxError {
429 418
             InvalidTxError::InvalidSignerId { signer_id } => {
430 419
                 write!(
431 420
                     f,
432
-                    "Invalid signer account ID {:?} according to requirements",
433
-                    signer_id
421
+                    "Invalid signer account ID {signer_id:?} according to requirements"
434 422
                 )
435 423
             }
436 424
             InvalidTxError::SignerDoesNotExist { signer_id } => {
437
-                write!(f, "Signer {:?} does not exist", signer_id)
425
+                write!(f, "Signer {signer_id:?} does not exist")
438 426
             }
439 427
             InvalidTxError::InvalidAccessKeyError(access_key_error) => {
440 428
                 Display::fmt(&access_key_error, f)
441 429
             }
442 430
             InvalidTxError::InvalidNonce { tx_nonce, ak_nonce } => write!(
443 431
                 f,
444
-                "Transaction nonce {} must be larger than nonce of the used access key {}",
445
-                tx_nonce, ak_nonce
432
+                "Transaction nonce {tx_nonce} must be larger than nonce of the used access key {ak_nonce}"
446 433
             ),
447 434
             InvalidTxError::InvalidReceiverId { receiver_id } => {
448 435
                 write!(
449 436
                     f,
450
-                    "Invalid receiver account ID {:?} according to requirements",
451
-                    receiver_id
437
+                    "Invalid receiver account ID {receiver_id:?} according to requirements"
452 438
                 )
453 439
             }
454 440
             InvalidTxError::InvalidSignature => {
@@ -460,11 +446,10 @@ impl Display for InvalidTxError {
460 446
                 cost,
461 447
             } => write!(
462 448
                 f,
463
-                "Sender {:?} does not have enough balance {} for operation costing {}",
464
-                signer_id, balance, cost
449
+                "Sender {signer_id:?} does not have enough balance {balance} for operation costing {cost}"
465 450
             ),
466 451
             InvalidTxError::LackBalanceForState { signer_id, amount } => {
467
-                write!(f, "Failed to execute, because the account {:?} wouldn't have enough balance to cover storage, required to have {} yoctoNEAR more", signer_id, amount)
452
+                write!(f, "Failed to execute, because the account {signer_id:?} wouldn't have enough balance to cover storage, required to have {amount} yoctoNEAR more")
468 453
             }
469 454
             InvalidTxError::CostOverflow => {
470 455
                 write!(f, "Transaction gas or balance cost is too high")
@@ -479,7 +464,7 @@ impl Display for InvalidTxError {
479 464
                 write!(f, "Transaction has expired")
480 465
             }
481 466
             InvalidTxError::ActionsValidation(error) => {
482
-                write!(f, "Transaction actions validation error: {}", error)
467
+                write!(f, "Transaction actions validation error: {error}")
483 468
             }
484 469
             InvalidTxError::NonceTooLarge {
485 470
                 tx_nonce,
@@ -487,15 +472,13 @@ impl Display for InvalidTxError {
487 472
             } => {
488 473
                 write!(
489 474
                     f,
490
-                    "Transaction nonce {} must be smaller than the access key nonce upper bound {}",
491
-                    tx_nonce, upper_bound
475
+                    "Transaction nonce {tx_nonce} must be smaller than the access key nonce upper bound {upper_bound}"
492 476
                 )
493 477
             }
494 478
             InvalidTxError::TransactionSizeExceeded { size, limit } => {
495 479
                 write!(
496 480
                     f,
497
-                    "Size of serialized transaction {} exceeded the limit {}",
498
-                    size, limit
481
+                    "Size of serialized transaction {size} exceeded the limit {limit}"
499 482
                 )
500 483
             }
501 484
         }
@@ -516,21 +499,18 @@ impl Display for InvalidAccessKeyError {
516 499
                 public_key,
517 500
             } => write!(
518 501
                 f,
519
-                "Signer {:?} doesn't have access key with the given public_key {}",
520
-                account_id, public_key
502
+                "Signer {account_id:?} doesn't have access key with the given public_key {public_key}"
521 503
             ),
522 504
             InvalidAccessKeyError::ReceiverMismatch {
523 505
                 tx_receiver,
524 506
                 ak_receiver,
525 507
             } => write!(
526 508
                 f,
527
-                "Transaction receiver_id {:?} doesn't match the access key receiver_id {:?}",
528
-                tx_receiver, ak_receiver
509
+                "Transaction receiver_id {tx_receiver:?} doesn't match the access key receiver_id {ak_receiver:?}",
529 510
             ),
530 511
             InvalidAccessKeyError::MethodNameMismatch { method_name } => write!(
531 512
                 f,
532
-                "Transaction method name {:?} isn't allowed by the access key",
533
-                method_name
513
+                "Transaction method name {method_name:?} isn't allowed by the access key"
534 514
             ),
535 515
             InvalidAccessKeyError::RequiresFullAccess => {
536 516
                 write!(f, "Invalid access key type. Full-access keys are required for transactions that have multiple or non-function-call actions")
@@ -542,8 +522,7 @@ impl Display for InvalidAccessKeyError {
542 522
                 cost,
543 523
             } => write!(
544 524
                 f,
545
-                "Access Key {:?}:{} does not have enough balance {} for transaction costing {}",
546
-                account_id, public_key, allowance, cost
525
+                "Access Key {account_id:?}:{public_key} does not have enough balance {allowance} for transaction costing {cost}"
547 526
             ),
548 527
             InvalidAccessKeyError::DepositWithFunctionCall => {
549 528
                 write!(f, "Having a deposit with a function call action is not allowed with a function call access key.")
@@ -644,7 +623,7 @@ pub struct IntegerOverflowError;
644 623
 
645 624
 impl std::fmt::Display for IntegerOverflowError {
646 625
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
647
-        f.write_str(&format!("{:?}", self))
626
+        f.write_str(&format!("{self:?}"))
648 627
     }
649 628
 }
650 629
 
@@ -701,61 +680,53 @@ impl Display for ActionErrorKind {
701 680
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
702 681
         match self {
703 682
             ActionErrorKind::AccountAlreadyExists { account_id } => {
704
-                write!(f, "Can't create a new account {:?}, because it already exists", account_id)
683
+                write!(f, "Can't create a new account {account_id:?}, because it already exists")
705 684
             }
706 685
             ActionErrorKind::AccountDoesNotExist { account_id } => write!(
707 686
                 f,
708
-                "Can't complete the action because account {:?} doesn't exist",
709
-                account_id
687
+                "Can't complete the action because account {account_id:?} doesn't exist"
710 688
             ),
711 689
             ActionErrorKind::ActorNoPermission { actor_id, account_id } => write!(
712 690
                 f,
713
-                "Actor {:?} doesn't have permission to account {:?} to complete the action",
714
-                actor_id, account_id
691
+                "Actor {actor_id:?} doesn't have permission to account {account_id:?} to complete the action"
715 692
             ),
716 693
             ActionErrorKind::LackBalanceForState { account_id, amount } => write!(
717 694
                 f,
718
-                "The account {} wouldn't have enough balance to cover storage, required to have {} yoctoNEAR more",
719
-                account_id, amount
695
+                "The account {account_id} wouldn't have enough balance to cover storage, required to have {amount} yoctoNEAR more"
720 696
             ),
721 697
             ActionErrorKind::TriesToUnstake { account_id } => {
722
-                write!(f, "Account {:?} is not yet staked, but tries to unstake", account_id)
698
+                write!(f, "Account {account_id:?} is not yet staked, but tries to unstake")
723 699
             }
724 700
             ActionErrorKind::TriesToStake { account_id, stake, locked, balance } => write!(
725 701
                 f,
726
-                "Account {:?} tries to stake {}, but has staked {} and only has {}",
727
-                account_id, stake, locked, balance
702
+                "Account {account_id:?} tries to stake {stake}, but has staked {locked} and only has {balance}"
728 703
             ),
729 704
             ActionErrorKind::CreateAccountOnlyByRegistrar { account_id, registrar_account_id, predecessor_id } => write!(
730 705
                 f,
731
-                "A top-level account ID {:?} can't be created by {:?}, short top-level account IDs can only be created by {:?}",
732
-                account_id, predecessor_id, registrar_account_id,
706
+                "A top-level account ID {account_id:?} can't be created by {predecessor_id:?}, short top-level account IDs can only be created by {registrar_account_id:?}"
733 707
             ),
734 708
             ActionErrorKind::CreateAccountNotAllowed { account_id, predecessor_id } => write!(
735 709
                 f,
736
-                "A sub-account ID {:?} can't be created by account {:?}",
737
-                account_id, predecessor_id,
710
+                "A sub-account ID {account_id:?} can't be created by account {predecessor_id:?}"
738 711
             ),
739 712
             ActionErrorKind::DeleteKeyDoesNotExist { account_id, .. } => write!(
740 713
                 f,
741
-                "Account {:?} tries to remove an access key that doesn't exist",
742
-                account_id
714
+                "Account {account_id:?} tries to remove an access key that doesn't exist"
743 715
             ),
744 716
             ActionErrorKind::AddKeyAlreadyExists { public_key, .. } => write!(
745 717
                 f,
746
-                "The public key {:?} is already used for an existing access key",
747
-                public_key
718
+                "The public key {public_key:?} is already used for an existing access key"
748 719
             ),
749 720
             ActionErrorKind::DeleteAccountStaking { account_id } => {
750
-                write!(f, "Account {:?} is staking and can not be deleted", account_id)
721
+                write!(f, "Account {account_id:?} is staking and can not be deleted")
751 722
             }
752
-            ActionErrorKind::FunctionCallError(s) => write!(f, "{:?}", s),
723
+            ActionErrorKind::FunctionCallError(s) => write!(f, "{s:?}"),
753 724
             ActionErrorKind::NewReceiptValidationError(e) => {
754
-                write!(f, "An new action receipt created during a FunctionCall is not valid: {}", e)
725
+                write!(f, "An new action receipt created during a FunctionCall is not valid: {e}")
755 726
             }
756
-            ActionErrorKind::InsufficientStake { account_id, stake, minimum_stake } => write!(f, "Account {} tries to stake {} but minimum required stake is {}", account_id, stake, minimum_stake),
757
-            ActionErrorKind::OnlyImplicitAccountCreationAllowed { account_id } => write!(f, "CreateAccount action is called on hex-characters account of length 64 {}", account_id),
758
-            ActionErrorKind::DeleteAccountWithLargeState { account_id } => write!(f, "The state of account {} is too large and therefore cannot be deleted", account_id),
727
+            ActionErrorKind::InsufficientStake { account_id, stake, minimum_stake } => write!(f, "Account {account_id} tries to stake {stake} but minimum required stake is {minimum_stake}"),
728
+            ActionErrorKind::OnlyImplicitAccountCreationAllowed { account_id } => write!(f, "CreateAccount action is called on hex-characters account of length 64 {account_id}"),
729
+            ActionErrorKind::DeleteAccountWithLargeState { account_id } => write!(f, "The state of account {account_id} is too large and therefore cannot be deleted"),
759 730
         }
760 731
     }
761 732
 }
@@ -787,17 +758,16 @@ impl Display for EpochError {
787 758
                 num_seats,
788 759
             } => write!(
789 760
                 f,
790
-                "Total stake {} must be higher than the number of seats {}",
791
-                stake_sum, num_seats
761
+                "Total stake {stake_sum} must be higher than the number of seats {num_seats}"
792 762
             ),
793
-            EpochError::MissingBlock(hash) => write!(f, "Missing block {}", hash),
794
-            EpochError::IOErr(err) => write!(f, "IO: {}", err),
795
-            EpochError::ShardingError(err) => write!(f, "Sharding Error: {}", err),
763
+            EpochError::MissingBlock(hash) => write!(f, "Missing block {hash}"),
764
+            EpochError::IOErr(err) => write!(f, "IO: {err}"),
765
+            EpochError::ShardingError(err) => write!(f, "Sharding Error: {err}"),
796 766
             EpochError::NotEnoughValidators {
797 767
                 num_shards,
798 768
                 num_validators,
799 769
             } => {
800
-                write!(f, "There were not enough validator proposals to fill all shards. num_proposals: {}, num_shards: {}", num_validators, num_shards)
770
+                write!(f, "There were not enough validator proposals to fill all shards. num_proposals: {num_validators}, num_shards: {num_shards}")
801 771
             }
802 772
         }
803 773
     }
@@ -810,16 +780,16 @@ impl Debug for EpochError {
810 780
                 stake_sum,
811 781
                 num_seats,
812 782
             } => {
813
-                write!(f, "ThresholdError({}, {})", stake_sum, num_seats)
783
+                write!(f, "ThresholdError({stake_sum}, {num_seats})")
814 784
             }
815
-            EpochError::MissingBlock(hash) => write!(f, "MissingBlock({})", hash),
816
-            EpochError::IOErr(err) => write!(f, "IOErr({})", err),
817
-            EpochError::ShardingError(err) => write!(f, "ShardingError({})", err),
785
+            EpochError::MissingBlock(hash) => write!(f, "MissingBlock({hash})"),
786
+            EpochError::IOErr(err) => write!(f, "IOErr({err})"),
787
+            EpochError::ShardingError(err) => write!(f, "ShardingError({err})"),
818 788
             EpochError::NotEnoughValidators {
819 789
                 num_shards,
820 790
                 num_validators,
821 791
             } => {
822
-                write!(f, "NotEnoughValidators({}, {})", num_validators, num_shards)
792
+                write!(f, "NotEnoughValidators({num_validators}, {num_shards})")
823 793
             }
824 794
         }
825 795
     }

+ 2
- 2
near-primitives-light/src/transaction.rs Просмотреть файл

@@ -274,12 +274,12 @@ impl fmt::Debug for ExecutionStatus {
274 274
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
275 275
         match self {
276 276
             ExecutionStatus::Unknown => f.write_str("Unknown"),
277
-            ExecutionStatus::Failure(e) => f.write_fmt(format_args!("Failure({})", e)),
277
+            ExecutionStatus::Failure(e) => f.write_fmt(format_args!("Failure({e})")),
278 278
             ExecutionStatus::SuccessValue(v) => {
279 279
                 f.write_fmt(format_args!("SuccessValue({})", to_base58(v)))
280 280
             }
281 281
             ExecutionStatus::SuccessReceiptId(receipt_id) => {
282
-                f.write_fmt(format_args!("SuccessReceiptId({})", receipt_id))
282
+                f.write_fmt(format_args!("SuccessReceiptId({receipt_id})"))
283 283
             }
284 284
         }
285 285
     }

+ 7
- 7
near-primitives-light/src/views.rs Просмотреть файл

@@ -613,9 +613,9 @@ impl fmt::Debug for FinalExecutionStatus {
613 613
         match self {
614 614
             FinalExecutionStatus::NotStarted => f.write_str("NotStarted"),
615 615
             FinalExecutionStatus::Started => f.write_str("Started"),
616
-            FinalExecutionStatus::Failure(e) => f.write_fmt(format_args!("Failure({:?})", e)),
616
+            FinalExecutionStatus::Failure(e) => f.write_fmt(format_args!("Failure({e:?})")),
617 617
             FinalExecutionStatus::SuccessValue(v) => {
618
-                f.write_fmt(format_args!("SuccessValue({:?})", v))
618
+                f.write_fmt(format_args!("SuccessValue({v:?})"))
619 619
             }
620 620
         }
621 621
     }
@@ -653,12 +653,12 @@ impl fmt::Debug for ExecutionStatusView {
653 653
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
654 654
         match self {
655 655
             ExecutionStatusView::Unknown => f.write_str("Unknown"),
656
-            ExecutionStatusView::Failure(e) => f.write_fmt(format_args!("Failure({:?})", e)),
656
+            ExecutionStatusView::Failure(e) => f.write_fmt(format_args!("Failure({e:?})")),
657 657
             ExecutionStatusView::SuccessValue(v) => {
658
-                f.write_fmt(format_args!("SuccessValue({:?})", v))
658
+                f.write_fmt(format_args!("SuccessValue({v:?})"))
659 659
             }
660 660
             ExecutionStatusView::SuccessReceiptId(receipt_id) => {
661
-                f.write_fmt(format_args!("SuccessReceiptId({})", receipt_id))
661
+                f.write_fmt(format_args!("SuccessReceiptId({receipt_id})"))
662 662
             }
663 663
         }
664 664
     }
@@ -715,10 +715,10 @@ impl From<ExecutionMetadata> for ExecutionMetadataView {
715 715
                         cost: match cost {
716 716
                             Cost::ActionCost {
717 717
                                 action_cost_kind: action_cost,
718
-                            } => format!("{:?}", action_cost).to_ascii_uppercase(),
718
+                            } => format!("{action_cost:?}").to_ascii_uppercase(),
719 719
                             Cost::ExtCost {
720 720
                                 ext_cost_kind: ext_cost,
721
-                            } => format!("{:?}", ext_cost).to_ascii_uppercase(),
721
+                            } => format!("{ext_cost:?}").to_ascii_uppercase(),
722 722
                             Cost::WasmInstruction => "WASM_INSTRUCTION".to_string(),
723 723
                         },
724 724
                         gas_used: profile_data[cost],

+ 1
- 0
near-rpc/src/client.rs Просмотреть файл

@@ -343,6 +343,7 @@ impl Output {
343 343
         serde_json::from_slice::<T>(&self.data).map_err(Error::DeserializeTransactionOutput)
344 344
     }
345 345
 
346
+    #[allow(clippy::misnamed_getters)]
346 347
     /// Returns a transaction id
347 348
     pub fn id(&self) -> CryptoHash {
348 349
         self.transaction.block_hash

+ 1
- 1
near-rpc/src/rpc/mod.rs Просмотреть файл

@@ -70,7 +70,7 @@ pub struct Cause {
70 70
 impl Display for Cause {
71 71
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
72 72
         if let Some(info) = &self.info {
73
-            return write!(f, "{}", info);
73
+            return write!(f, "{info}");
74 74
         }
75 75
 
76 76
         Ok(())

+ 1
- 1
near-rpc/tests/rpc.rs Просмотреть файл

@@ -59,7 +59,7 @@ async fn download_contract() -> Vec<u8> {
59 59
 async fn clone_and_compile_wasm() -> Vec<u8> {
60 60
     let tmp_path = temp_dir().into_path();
61 61
     let repo_path = format!("{}/near-smartcontracts", tmp_path.to_string_lossy());
62
-    let target_path = format!("{}/test-contract", repo_path);
62
+    let target_path = format!("{repo_path}/test-contract");
63 63
     let repo_url = "git@github.com:Relayz-io/near-smartcontracts.git";
64 64
 
65 65
     // Prepare callbacks.

Загрузка…
Отмена
Сохранить