diff --git a/core/control-panel/impl/src/controllers/canister.rs b/core/control-panel/impl/src/controllers/canister.rs index b62486745..0d625757e 100644 --- a/core/control-panel/impl/src/controllers/canister.rs +++ b/core/control-panel/impl/src/controllers/canister.rs @@ -31,7 +31,7 @@ fn init_timers_fn() { async fn initialize_rng_timer() { use orbit_essentials::utils::initialize_rng; if let Err(e) = initialize_rng().await { - ic_cdk::print(format!("initializing rng failed: {}", e)); + ic_cdk::print(format!("initializing rng failed: {e}")); ic_cdk_timers::set_timer(std::time::Duration::from_secs(60), move || { spawn(initialize_rng_timer()) }); diff --git a/core/control-panel/impl/src/controllers/http.rs b/core/control-panel/impl/src/controllers/http.rs index 5198c9ac0..94bad9def 100644 --- a/core/control-panel/impl/src/controllers/http.rs +++ b/core/control-panel/impl/src/controllers/http.rs @@ -145,8 +145,7 @@ mod tests { assert_eq!( response.body, format!( - r#"[{{"targets": ["{}"],"labels": {{"__metrics_path__":"/metrics","dapp":"orbit"}}}}]"#, - station_host + r#"[{{"targets": ["{station_host}"],"labels": {{"__metrics_path__":"/metrics","dapp":"orbit"}}}}]"# ) .as_bytes() .to_owned() diff --git a/core/control-panel/impl/src/core/middlewares.rs b/core/control-panel/impl/src/core/middlewares.rs index 85299e2a1..761889f88 100644 --- a/core/control-panel/impl/src/core/middlewares.rs +++ b/core/control-panel/impl/src/core/middlewares.rs @@ -27,7 +27,7 @@ where ic_cdk::api::print( serde_json::to_string(&LogMessage { function: target_fn.to_string(), - message: format!("completed execution with result {:?}", result), + message: format!("completed execution with result {result:?}"), timestamp: ic_cdk::api::time(), caller: context.caller().to_text(), }) diff --git a/core/control-panel/impl/src/mappers/helper.rs b/core/control-panel/impl/src/mappers/helper.rs index 7cfc08054..24c13b0d7 100644 --- a/core/control-panel/impl/src/mappers/helper.rs +++ b/core/control-panel/impl/src/mappers/helper.rs @@ -39,8 +39,7 @@ impl HelperMapper { } print(format!( - "Failed to parse semver {}, fallback to 0.0.0", - version_text + "Failed to parse semver {version_text}, fallback to 0.0.0" )); semver::Version::new(0, 0, 0) diff --git a/core/control-panel/impl/src/models/registry_entry.rs b/core/control-panel/impl/src/models/registry_entry.rs index d82f4571f..babcfcdfb 100644 --- a/core/control-panel/impl/src/models/registry_entry.rs +++ b/core/control-panel/impl/src/models/registry_entry.rs @@ -232,7 +232,7 @@ fn validate_wasm_module_version(version: &str) -> ModelValidatorResult ModelValidatorResult ModelValidatorResult { } if let Err(e) = EmailAddress::from_str(email) { return Err(UserError::ValidationError { - info: format!("Email validation failed: {}", e,), + info: format!("Email validation failed: {e}",), }); } @@ -166,7 +166,7 @@ fn validate_stations(stations: &[UserStation]) -> ModelValidatorResult ModelValidatorResult { for label in labels { if label.len() > MAX_LABEL_LEN { return Err(UserError::ValidationError { - info: format!("Station label length cannot exceed {}", MAX_LABEL_LEN), + info: format!("Station label length cannot exceed {MAX_LABEL_LEN}"), }); } diff --git a/core/control-panel/impl/src/repositories/indexes/registry_index.rs b/core/control-panel/impl/src/repositories/indexes/registry_index.rs index c5680f6ef..9e1450c50 100644 --- a/core/control-panel/impl/src/repositories/indexes/registry_index.rs +++ b/core/control-panel/impl/src/repositories/indexes/registry_index.rs @@ -100,7 +100,7 @@ mod tests { let repository = RegistryIndexRepository::default(); for i in 0..10 { repository.insert(RegistryIndex { - index: RegistryIndexKind::Namespace(format!("ns-{}", i)), + index: RegistryIndexKind::Namespace(format!("ns-{i}")), registry_entry_id: [i; 16], }); } diff --git a/core/control-panel/impl/src/repositories/registry.rs b/core/control-panel/impl/src/repositories/registry.rs index a875d3cc9..a8f8c6be4 100644 --- a/core/control-panel/impl/src/repositories/registry.rs +++ b/core/control-panel/impl/src/repositories/registry.rs @@ -577,7 +577,7 @@ mod tests { for i in 0..5 { let mut entry = create_registry_entry(); entry.namespace = "orbit".to_string(); - entry.name = format!("entry-{}", i); + entry.name = format!("entry-{i}"); entry.validate().unwrap(); repository.insert(entry.id, entry); @@ -607,7 +607,7 @@ mod tests { for i in 0..5 { let mut entry = create_registry_entry(); entry.namespace = "orbit".to_string(); - entry.name = format!("entry-{}", i); + entry.name = format!("entry-{i}"); entry.validate().unwrap(); repository.insert(entry.id, entry); @@ -636,7 +636,7 @@ mod tests { for i in 0..5 { let mut entry = create_registry_entry(); entry.namespace = RegistryEntry::DEFAULT_NAMESPACE.to_string(); - entry.name = format!("entry-{}", i); + entry.name = format!("entry-{i}"); entry.validate().unwrap(); repository.insert(entry.id, entry); @@ -661,7 +661,7 @@ mod tests { let repository = RegistryRepository::default(); for i in 0..5 { let mut entry = create_registry_entry(); - entry.categories.push(format!("category-{}", i)); + entry.categories.push(format!("category-{i}")); entry.validate().unwrap(); repository.insert(entry.id, entry); @@ -693,7 +693,7 @@ mod tests { let repository = RegistryRepository::default(); for i in 0..5 { let mut entry = create_registry_entry(); - entry.tags.push(format!("tag-{}", i)); + entry.tags.push(format!("tag-{i}")); entry.validate().unwrap(); repository.insert(entry.id, entry); @@ -749,7 +749,7 @@ mod tests { entry.name = "station".to_string(); entry.value = RegistryValue::WasmModule(WasmModuleRegistryValue { wasm_artifact_id: *Uuid::new_v4().as_bytes(), - version: format!("1.0.{}", i), + version: format!("1.0.{i}"), dependencies: Vec::new(), module_extra_chunks: None, }); diff --git a/core/control-panel/impl/src/services/canister.rs b/core/control-panel/impl/src/services/canister.rs index 14c9bc77c..dc720bbb1 100644 --- a/core/control-panel/impl/src/services/canister.rs +++ b/core/control-panel/impl/src/services/canister.rs @@ -139,7 +139,7 @@ impl CanisterService { USER_REPOSITORY.insert(user.to_key(), user.clone()); }), - Some(version) => print(format!("No migration for version: {}", version)), + Some(version) => print(format!("No migration for version: {version}")), }; } } diff --git a/core/control-panel/impl/src/services/registry.rs b/core/control-panel/impl/src/services/registry.rs index ec6494ef4..a2289db7c 100644 --- a/core/control-panel/impl/src/services/registry.rs +++ b/core/control-panel/impl/src/services/registry.rs @@ -343,7 +343,7 @@ mod tests { for i in 0..10 { let mut entry = create_registry_entry(); entry.namespace = "orbit".to_string(); - entry.name = format!("module-{}", i); + entry.name = format!("module-{i}"); REGISTRY_REPOSITORY.insert(entry.id, entry.clone()); } @@ -387,7 +387,7 @@ mod tests { for i in 0..10 { let mut entry = create_registry_entry(); entry.namespace = "test".to_string(); - entry.name = format!("module-{}", i); + entry.name = format!("module-{i}"); REGISTRY_REPOSITORY.insert(entry.id, entry.clone()); } @@ -415,7 +415,7 @@ mod tests { entry.name = "module".to_string(); entry.value = RegistryValue::WasmModule(WasmModuleRegistryValue { wasm_artifact_id: *Uuid::new_v4().as_bytes(), - version: format!("1.0.{}", i), + version: format!("1.0.{i}"), dependencies: Vec::new(), module_extra_chunks: None, }); @@ -583,7 +583,7 @@ mod tests { entry.name = "module".to_string(); entry.value = RegistryValue::WasmModule(WasmModuleRegistryValue { wasm_artifact_id: *Uuid::new_v4().as_bytes(), - version: format!("1.0.{}", i), + version: format!("1.0.{i}"), dependencies: Vec::new(), module_extra_chunks: None, }); @@ -611,7 +611,7 @@ mod tests { entry.name = "module".to_string(); entry.value = RegistryValue::WasmModule(WasmModuleRegistryValue { wasm_artifact_id: *Uuid::new_v4().as_bytes(), - version: format!("1.0.{}", i), + version: format!("1.0.{i}"), dependencies: Vec::new(), module_extra_chunks: None, }); diff --git a/core/station/api/src/notification.rs b/core/station/api/src/notification.rs index 090fca7ae..a5b116af4 100644 --- a/core/station/api/src/notification.rs +++ b/core/station/api/src/notification.rs @@ -54,10 +54,10 @@ impl Display for NotificationTypeInput { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { NotificationTypeInput::SystemMessage => { - write!(f, "{}", SYSTEM_MESSAGE_NOTIFICATION_TYPE) + write!(f, "{SYSTEM_MESSAGE_NOTIFICATION_TYPE}") } NotificationTypeInput::RequestCreated => { - write!(f, "{}", REQUEST_CREATED_NOTIFICATION_TYPE) + write!(f, "{REQUEST_CREATED_NOTIFICATION_TYPE}") } } } diff --git a/core/station/impl/src/controllers/external_canister.rs b/core/station/impl/src/controllers/external_canister.rs index bc13a7cb7..2130a25a1 100644 --- a/core/station/impl/src/controllers/external_canister.rs +++ b/core/station/impl/src/controllers/external_canister.rs @@ -23,7 +23,7 @@ async fn canister_status(input: CanisterStatusInput) -> CanisterStatusResponse { CONTROLLER .canister_status(input) .await - .unwrap_or_else(|e| trap(&format!("{:?}", e))) + .unwrap_or_else(|e| trap(&format!("{e:?}"))) } #[update(name = "canister_snapshots")] diff --git a/core/station/impl/src/controllers/notification.rs b/core/station/impl/src/controllers/notification.rs index f9c43d4a2..dd73e1bfc 100644 --- a/core/station/impl/src/controllers/notification.rs +++ b/core/station/impl/src/controllers/notification.rs @@ -65,7 +65,7 @@ impl NotificationController { NotificationMapperError::InvalidRequestStatus { expected, found } => { - print(format!("Invalid request status when mapping to NotificationDTO: expected \"{}\", found \"{}\"", expected, found)); + print(format!("Invalid request status when mapping to NotificationDTO: expected \"{expected}\", found \"{found}\"")); } }, } diff --git a/core/station/impl/src/core/middlewares.rs b/core/station/impl/src/core/middlewares.rs index 46ca206b2..d43d7cc75 100644 --- a/core/station/impl/src/core/middlewares.rs +++ b/core/station/impl/src/core/middlewares.rs @@ -31,7 +31,7 @@ pub fn authorize(ctx: &CallContext, resources: &[Resource]) { let allowed = Authorization::is_allowed(ctx, resource); if !allowed { - unauthorized_resources.push(format!("{}", resource)); + unauthorized_resources.push(format!("{resource}")); } allowed diff --git a/core/station/impl/src/core/observer.rs b/core/station/impl/src/core/observer.rs index 383ad82a8..2b0e19570 100644 --- a/core/station/impl/src/core/observer.rs +++ b/core/station/impl/src/core/observer.rs @@ -71,6 +71,6 @@ mod tests { fn test_observer_debug() { let observer = Observer::::default(); - assert_eq!(format!("{:?}", observer), "Observer { listeners: 0 }"); + assert_eq!(format!("{observer:?}"), "Observer { listeners: 0 }"); } } diff --git a/core/station/impl/src/errors/request.rs b/core/station/impl/src/errors/request.rs index 23882eb80..6d363113e 100644 --- a/core/station/impl/src/errors/request.rs +++ b/core/station/impl/src/errors/request.rs @@ -88,7 +88,7 @@ impl From for RequestError { fn from(err: RecordValidationError) -> RequestError { match err { RecordValidationError::NotFound { id, model_name } => RequestError::ValidationError { - info: format!("Invalid UUID: {} {} not found", model_name, id), + info: format!("Invalid UUID: {model_name} {id} not found"), }, } } @@ -99,7 +99,7 @@ impl From for RequestError { match err { ExternalCanisterValidationError::InvalidExternalCanister { principal } => { RequestError::ValidationError { - info: format!("Invalid external canister {}", principal), + info: format!("Invalid external canister {principal}"), } } ExternalCanisterValidationError::ValidationError { info } => { diff --git a/core/station/impl/src/errors/request_policy.rs b/core/station/impl/src/errors/request_policy.rs index cfc538b6e..9a099e952 100644 --- a/core/station/impl/src/errors/request_policy.rs +++ b/core/station/impl/src/errors/request_policy.rs @@ -55,7 +55,7 @@ impl From for RequestPolicyError { match err { RecordValidationError::NotFound { id, model_name } => { RequestPolicyError::ValidationError { - info: format!("Invalid UUID: {} {} not found", model_name, id), + info: format!("Invalid UUID: {model_name} {id} not found"), } } } @@ -67,7 +67,7 @@ impl From for RequestPolicyError { match err { ExternalCanisterValidationError::InvalidExternalCanister { principal } => { RequestPolicyError::ValidationError { - info: format!("Invalid external canister {}", principal), + info: format!("Invalid external canister {principal}"), } } ExternalCanisterValidationError::ValidationError { info } => { diff --git a/core/station/impl/src/errors/validation.rs b/core/station/impl/src/errors/validation.rs index b7eca8b23..890407c2f 100644 --- a/core/station/impl/src/errors/validation.rs +++ b/core/station/impl/src/errors/validation.rs @@ -13,9 +13,9 @@ pub enum ValidationError { impl Display for ValidationError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - ValidationError::RecordValidationError(err) => write!(f, "{}", err), - ValidationError::ExternalCanisterValidationError(err) => write!(f, "{}", err), - ValidationError::SystemInfoValidationError(err) => write!(f, "{}", err), + ValidationError::RecordValidationError(err) => write!(f, "{err}"), + ValidationError::ExternalCanisterValidationError(err) => write!(f, "{err}"), + ValidationError::SystemInfoValidationError(err) => write!(f, "{err}"), } } } diff --git a/core/station/impl/src/factories/blockchains/internet_computer.rs b/core/station/impl/src/factories/blockchains/internet_computer.rs index 83cdac860..9c17c467d 100644 --- a/core/station/impl/src/factories/blockchains/internet_computer.rs +++ b/core/station/impl/src/factories/blockchains/internet_computer.rs @@ -253,21 +253,21 @@ impl InternetComputer { .map_err(|err| BlockchainApiError::TransactionSubmitFailed { info: match err { ic_ledger_types::TransferError::BadFee { expected_fee } => { - format!("Bad fee, expected: {}", expected_fee) + format!("Bad fee, expected: {expected_fee}") } ic_ledger_types::TransferError::InsufficientFunds { balance } => { - format!("Insufficient balance, balance: {}", balance) + format!("Insufficient balance, balance: {balance}") } ic_ledger_types::TransferError::TxTooOld { allowed_window_nanos, } => { - format!("Tx too old, allowed_window_nanos: {}", allowed_window_nanos) + format!("Tx too old, allowed_window_nanos: {allowed_window_nanos}") } ic_ledger_types::TransferError::TxCreatedInFuture => { "Tx created in future".to_string() } ic_ledger_types::TransferError::TxDuplicate { duplicate_of } => { - format!("Tx duplicate, duplicate_of: {}", duplicate_of) + format!("Tx duplicate, duplicate_of: {duplicate_of}") } }, })?; @@ -291,8 +291,7 @@ impl InternetComputer { }, None => { print(format!( - "Error: no ICP ledger block found at height {}", - block_height + "Error: no ICP ledger block found at height {block_height}" )); None } @@ -368,12 +367,12 @@ impl InternetComputer { .map_err(|err| BlockchainApiError::TransactionSubmitFailed { info: match err { icrc_ledger_types::icrc1::transfer::TransferError::BadFee { expected_fee } => { - format!("Bad fee, expected: {}", expected_fee) + format!("Bad fee, expected: {expected_fee}") } icrc_ledger_types::icrc1::transfer::TransferError::InsufficientFunds { balance, } => { - format!("Insufficient balance, balance: {}", balance) + format!("Insufficient balance, balance: {balance}") } icrc_ledger_types::icrc1::transfer::TransferError::TooOld => { "Tx too old".to_string() @@ -382,10 +381,10 @@ impl InternetComputer { "Tx created in future".to_string() } icrc_ledger_types::icrc1::transfer::TransferError::Duplicate { duplicate_of } => { - format!("Tx duplicate, duplicate_of: {}", duplicate_of) + format!("Tx duplicate, duplicate_of: {duplicate_of}") } icrc_ledger_types::icrc1::transfer::TransferError::BadBurn { min_burn_amount } => { - format!("Bad burn, min_burn_amount: {}", min_burn_amount) + format!("Bad burn, min_burn_amount: {min_burn_amount}") } icrc_ledger_types::icrc1::transfer::TransferError::TemporarilyUnavailable => { "Ledger temporarily unavailable".to_string() @@ -394,7 +393,7 @@ impl InternetComputer { error_code, message, } => { - format!("Error occurred. Code: {}, message: {}", error_code, message) + format!("Error occurred. Code: {error_code}, message: {message}") } }, })?; diff --git a/core/station/impl/src/factories/requests/add_account.rs b/core/station/impl/src/factories/requests/add_account.rs index 4997e0d8a..eb236a561 100644 --- a/core/station/impl/src/factories/requests/add_account.rs +++ b/core/station/impl/src/factories/requests/add_account.rs @@ -57,7 +57,7 @@ impl Execute for AddAccountRequestExecute<'_, '_> { .create_account(self.operation.input.to_owned(), None) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create account: {}", e), + reason: format!("Failed to create account: {e}"), })?; let mut operation = self.request.operation.clone(); diff --git a/core/station/impl/src/factories/requests/add_address_book_entry.rs b/core/station/impl/src/factories/requests/add_address_book_entry.rs index 52a3c5565..a0d7d7cc8 100644 --- a/core/station/impl/src/factories/requests/add_address_book_entry.rs +++ b/core/station/impl/src/factories/requests/add_address_book_entry.rs @@ -51,7 +51,7 @@ impl Execute for AddAddressBookEntryRequestExecute<'_, '_> { .create_entry(self.operation.input.to_owned()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create address book entry: {}", e), + reason: format!("Failed to create address book entry: {e}"), })?; let mut operation = self.request.operation.clone(); diff --git a/core/station/impl/src/factories/requests/add_asset.rs b/core/station/impl/src/factories/requests/add_asset.rs index a808f1ab9..892b70dce 100644 --- a/core/station/impl/src/factories/requests/add_asset.rs +++ b/core/station/impl/src/factories/requests/add_asset.rs @@ -56,7 +56,7 @@ impl Execute for AddAssetRequestExecute<'_, '_> { .asset_service .create(self.operation.input.clone(), None) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create asset: {}", e), + reason: format!("Failed to create asset: {e}"), })?; let mut operation = self.request.operation.clone(); diff --git a/core/station/impl/src/factories/requests/add_named_rule.rs b/core/station/impl/src/factories/requests/add_named_rule.rs index 1c9db27e3..3aedddc3e 100644 --- a/core/station/impl/src/factories/requests/add_named_rule.rs +++ b/core/station/impl/src/factories/requests/add_named_rule.rs @@ -57,7 +57,7 @@ impl Execute for AddNamedRuleRequestExecute<'_, '_> { .named_rule_service .create(self.operation.input.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create named rule: {}", e), + reason: format!("Failed to create named rule: {e}"), })?; let mut operation = self.request.operation.clone(); diff --git a/core/station/impl/src/factories/requests/add_request_policy.rs b/core/station/impl/src/factories/requests/add_request_policy.rs index d2fe01307..c19fee3b3 100644 --- a/core/station/impl/src/factories/requests/add_request_policy.rs +++ b/core/station/impl/src/factories/requests/add_request_policy.rs @@ -61,7 +61,7 @@ impl Execute for AddRequestPolicyRequestExecute<'_, '_> { .policy_service .add_request_policy(self.operation.input.to_owned()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create request policy: {}", e), + reason: format!("Failed to create request policy: {e}"), })?; let mut operation = self.request.operation.clone(); @@ -139,7 +139,7 @@ mod tests { match stage { RequestExecuteStage::Completed(_) => (), - _ => panic!("Expected RequestExecuteStage::Completed, got {:?}", stage), + _ => panic!("Expected RequestExecuteStage::Completed, got {stage:?}"), } } else { panic!( diff --git a/core/station/impl/src/factories/requests/add_user.rs b/core/station/impl/src/factories/requests/add_user.rs index 746b2234d..cfb69df61 100644 --- a/core/station/impl/src/factories/requests/add_user.rs +++ b/core/station/impl/src/factories/requests/add_user.rs @@ -50,7 +50,7 @@ impl Execute for AddUserRequestExecute<'_, '_> { let user = USER_SERVICE .add_user(self.operation.input.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create user: {}", e), + reason: format!("Failed to create user: {e}"), })?; let mut operation = self.request.operation.clone(); diff --git a/core/station/impl/src/factories/requests/add_user_group.rs b/core/station/impl/src/factories/requests/add_user_group.rs index 20266b421..21506321c 100644 --- a/core/station/impl/src/factories/requests/add_user_group.rs +++ b/core/station/impl/src/factories/requests/add_user_group.rs @@ -48,7 +48,7 @@ impl Execute for AddUserGroupRequestExecute<'_, '_> { .create(self.operation.input.clone()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to create user group: {}", e), + reason: format!("Failed to create user group: {e}"), })?; let mut operation = self.request.operation.clone(); diff --git a/core/station/impl/src/factories/requests/call_canister.rs b/core/station/impl/src/factories/requests/call_canister.rs index 448784ffc..1ad1f9510 100644 --- a/core/station/impl/src/factories/requests/call_canister.rs +++ b/core/station/impl/src/factories/requests/call_canister.rs @@ -65,7 +65,7 @@ impl Create for CallExternalCanisterRequestC } })?; Some(rendering.map_err(|err| RequestError::ValidationError { - info: format!("failed to validate call external canister request: {}", err), + info: format!("failed to validate call external canister request: {err}"), })?) } None => None, diff --git a/core/station/impl/src/factories/requests/configure_external_canister.rs b/core/station/impl/src/factories/requests/configure_external_canister.rs index 24e7632a2..277d762d4 100644 --- a/core/station/impl/src/factories/requests/configure_external_canister.rs +++ b/core/station/impl/src/factories/requests/configure_external_canister.rs @@ -59,7 +59,7 @@ impl<'p, 'o> ConfigureExternalCanisterRequestExecute<'p, 'o> { .external_canister_service .get_external_canister_by_canister_id(&self.operation.canister_id) .map_err(|e| RequestExecuteError::Failed { - reason: format!("External canister not found: {}", e), + reason: format!("External canister not found: {e}"), })?; Ok(external_canister) @@ -78,7 +78,7 @@ impl Execute for ConfigureExternalCanisterRequestExecute<'_, '_> { .hard_delete_external_canister(&external_canister.id) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to delete canister: {}", e), + reason: format!("Failed to delete canister: {e}"), })?; } ConfigureExternalCanisterOperationKind::SoftDelete => { @@ -87,7 +87,7 @@ impl Execute for ConfigureExternalCanisterRequestExecute<'_, '_> { self.external_canister_service .soft_delete_external_canister(&external_canister.id) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to soft delete canister: {}", e), + reason: format!("Failed to soft delete canister: {e}"), })?; } ConfigureExternalCanisterOperationKind::Settings(settings) => { @@ -96,7 +96,7 @@ impl Execute for ConfigureExternalCanisterRequestExecute<'_, '_> { self.external_canister_service .edit_external_canister(&external_canister.id, settings.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to configure settings: {}", e), + reason: format!("Failed to configure settings: {e}"), })?; } // these operations do not require an external canister entry @@ -105,7 +105,7 @@ impl Execute for ConfigureExternalCanisterRequestExecute<'_, '_> { .change_canister_ic_settings(self.operation.canister_id, settings.clone()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to configure native settings: {}", e), + reason: format!("Failed to configure native settings: {e}"), })?; } } diff --git a/core/station/impl/src/factories/requests/create_canister.rs b/core/station/impl/src/factories/requests/create_canister.rs index 56447568a..a72e491d7 100644 --- a/core/station/impl/src/factories/requests/create_canister.rs +++ b/core/station/impl/src/factories/requests/create_canister.rs @@ -63,7 +63,7 @@ impl Execute for CreateExternalCanisterRequestExecute<'_, '_> { .add_external_canister(self.operation.input.clone()) .await .map_err(|err| RequestExecuteError::Failed { - reason: format!("failed to add external canister: {}", err), + reason: format!("failed to add external canister: {err}"), })?; let mut create_operation = self.operation.clone(); diff --git a/core/station/impl/src/factories/requests/edit_account.rs b/core/station/impl/src/factories/requests/edit_account.rs index ba95357b4..adbcb91d5 100644 --- a/core/station/impl/src/factories/requests/edit_account.rs +++ b/core/station/impl/src/factories/requests/edit_account.rs @@ -50,7 +50,7 @@ impl Execute for EditAccountRequestExecute<'_, '_> { .edit_account(self.operation.input.to_owned()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to update account: {}", e), + reason: format!("Failed to update account: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/edit_address_book_entry.rs b/core/station/impl/src/factories/requests/edit_address_book_entry.rs index f9d06e35f..c5f711f2c 100644 --- a/core/station/impl/src/factories/requests/edit_address_book_entry.rs +++ b/core/station/impl/src/factories/requests/edit_address_book_entry.rs @@ -24,7 +24,7 @@ impl Create for EditAddressBook ) -> Result { let address_book_entry_id = HelperMapper::to_uuid(operation_input.address_book_entry_id) .map_err(|e| RequestError::ValidationError { - info: format!("Invalid address book entry id: {}", e), + info: format!("Invalid address book entry id: {e}"), })?; let request = Request::from_request_creation_input( @@ -64,7 +64,7 @@ impl Execute for EditAddressBookEntryRequestExecute<'_, '_> { .edit_entry(self.operation.input.to_owned()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to update address book entry: {}", e), + reason: format!("Failed to update address book entry: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/edit_asset.rs b/core/station/impl/src/factories/requests/edit_asset.rs index 2e83fec5a..6e53a9cb8 100644 --- a/core/station/impl/src/factories/requests/edit_asset.rs +++ b/core/station/impl/src/factories/requests/edit_asset.rs @@ -54,7 +54,7 @@ impl Execute for EditAssetRequestExecute<'_, '_> { self.asset_service .edit(self.operation.input.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to edit asset: {}", e), + reason: format!("Failed to edit asset: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/edit_named_rule.rs b/core/station/impl/src/factories/requests/edit_named_rule.rs index 6d8276a14..9c8f06e49 100644 --- a/core/station/impl/src/factories/requests/edit_named_rule.rs +++ b/core/station/impl/src/factories/requests/edit_named_rule.rs @@ -55,7 +55,7 @@ impl Execute for EditNamedRuleRequestExecute<'_, '_> { self.named_rule_service .edit(self.operation.input.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to edit named rule: {}", e), + reason: format!("Failed to edit named rule: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/edit_permission.rs b/core/station/impl/src/factories/requests/edit_permission.rs index d1f7fa043..825fa4bb9 100644 --- a/core/station/impl/src/factories/requests/edit_permission.rs +++ b/core/station/impl/src/factories/requests/edit_permission.rs @@ -59,7 +59,7 @@ impl Execute for EditPermissionRequestExecute<'_, '_> { self.policy_service .edit_permission(self.operation.input.to_owned()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to update permission: {}", e), + reason: format!("Failed to update permission: {e}"), })?; Ok(RequestExecuteStage::Completed( @@ -140,7 +140,7 @@ mod tests { match stage { RequestExecuteStage::Completed(_) => (), - _ => panic!("Expected RequestExecuteStage::Completed, got {:?}", stage), + _ => panic!("Expected RequestExecuteStage::Completed, got {stage:?}"), } } else { panic!( diff --git a/core/station/impl/src/factories/requests/edit_request_policy.rs b/core/station/impl/src/factories/requests/edit_request_policy.rs index 10da2a887..42cb82e96 100644 --- a/core/station/impl/src/factories/requests/edit_request_policy.rs +++ b/core/station/impl/src/factories/requests/edit_request_policy.rs @@ -72,7 +72,7 @@ impl Execute for EditRequestPolicyRequestExecute<'_, '_> { self.policy_service .edit_request_policy(self.operation.input.to_owned()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to update request policy: {}", e), + reason: format!("Failed to update request policy: {e}"), })?; Ok(RequestExecuteStage::Completed( @@ -166,7 +166,7 @@ mod tests { match stage { RequestExecuteStage::Completed(_) => (), - _ => panic!("Expected RequestExecuteStage::Completed, got {:?}", stage), + _ => panic!("Expected RequestExecuteStage::Completed, got {stage:?}"), } } else { panic!( diff --git a/core/station/impl/src/factories/requests/edit_user.rs b/core/station/impl/src/factories/requests/edit_user.rs index 6ef816602..6bace8d17 100644 --- a/core/station/impl/src/factories/requests/edit_user.rs +++ b/core/station/impl/src/factories/requests/edit_user.rs @@ -50,7 +50,7 @@ impl Execute for EditUserRequestExecute<'_, '_> { .edit_user(self.operation.input.clone()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to edit user: {}", e), + reason: format!("Failed to edit user: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/edit_user_group.rs b/core/station/impl/src/factories/requests/edit_user_group.rs index 727432e58..d90ccf0b6 100644 --- a/core/station/impl/src/factories/requests/edit_user_group.rs +++ b/core/station/impl/src/factories/requests/edit_user_group.rs @@ -48,7 +48,7 @@ impl Execute for EditUserGroupRequestExecute<'_, '_> { .edit(self.operation.input.clone()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to edit user group: {}", e), + reason: format!("Failed to edit user group: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/fund_external_canister.rs b/core/station/impl/src/factories/requests/fund_external_canister.rs index f97508ebd..57742cf37 100644 --- a/core/station/impl/src/factories/requests/fund_external_canister.rs +++ b/core/station/impl/src/factories/requests/fund_external_canister.rs @@ -62,7 +62,7 @@ impl Execute for FundExternalCanisterRequestExecute<'_, '_> { .top_up_canister(self.operation.canister_id, input.cycles as u128) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to fund canister: {}", e), + reason: format!("Failed to fund canister: {e}"), })?; } } diff --git a/core/station/impl/src/factories/requests/monitor_external_canister.rs b/core/station/impl/src/factories/requests/monitor_external_canister.rs index 087849f07..d45970733 100644 --- a/core/station/impl/src/factories/requests/monitor_external_canister.rs +++ b/core/station/impl/src/factories/requests/monitor_external_canister.rs @@ -66,14 +66,14 @@ impl Execute for MonitorExternalCanisterRequestExecute<'_, '_> { input.cycle_obtain_strategy, ) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to monitor canister: {}", e), + reason: format!("Failed to monitor canister: {e}"), })?; } MonitorExternalCanisterOperationKind::Stop => { self.external_canister_service .canister_monitor_stop(self.operation.canister_id) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to stop monitoring canister: {}", e), + reason: format!("Failed to stop monitoring canister: {e}"), })?; } } diff --git a/core/station/impl/src/factories/requests/remove_address_book_entry.rs b/core/station/impl/src/factories/requests/remove_address_book_entry.rs index 8e92c5035..4352b0e7c 100644 --- a/core/station/impl/src/factories/requests/remove_address_book_entry.rs +++ b/core/station/impl/src/factories/requests/remove_address_book_entry.rs @@ -26,7 +26,7 @@ impl Create ) -> Result { let address_book_entry_id = HelperMapper::to_uuid(operation_input.address_book_entry_id) .map_err(|e| RequestError::ValidationError { - info: format!("Invalid address book entry id: {}", e), + info: format!("Invalid address book entry id: {e}"), })?; let request = Request::from_request_creation_input( @@ -63,7 +63,7 @@ impl Execute for RemoveAddressBookEntryRequestExecute<'_, '_> { .remove_entry(self.operation.input.to_owned()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to remove address book entry: {}", e), + reason: format!("Failed to remove address book entry: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/remove_asset.rs b/core/station/impl/src/factories/requests/remove_asset.rs index ab331c46d..6285d6c35 100644 --- a/core/station/impl/src/factories/requests/remove_asset.rs +++ b/core/station/impl/src/factories/requests/remove_asset.rs @@ -54,7 +54,7 @@ impl Execute for RemoveAssetRequestExecute<'_, '_> { self.asset_service .remove(self.operation.input.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to remove asset: {}", e), + reason: format!("Failed to remove asset: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/remove_named_rule.rs b/core/station/impl/src/factories/requests/remove_named_rule.rs index 121d2161a..9cf9816a3 100644 --- a/core/station/impl/src/factories/requests/remove_named_rule.rs +++ b/core/station/impl/src/factories/requests/remove_named_rule.rs @@ -54,7 +54,7 @@ impl Execute for RemoveNamedRuleRequestExecute<'_, '_> { self.named_rule_service .remove(self.operation.input.clone()) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to remove named rule: {}", e), + reason: format!("Failed to remove named rule: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/remove_request_policy.rs b/core/station/impl/src/factories/requests/remove_request_policy.rs index 1b510027d..075060bab 100644 --- a/core/station/impl/src/factories/requests/remove_request_policy.rs +++ b/core/station/impl/src/factories/requests/remove_request_policy.rs @@ -72,7 +72,7 @@ impl Execute for RemoveRequestPolicyRequestExecute<'_, '_> { self.policy_service .remove_request_policy(&self.operation.input.policy_id) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to remove request policy: {}", e), + reason: format!("Failed to remove request policy: {e}"), })?; Ok(RequestExecuteStage::Completed( @@ -168,7 +168,7 @@ mod tests { match stage { RequestExecuteStage::Completed(_) => (), - _ => panic!("Expected RequestExecuteStage::Completed, got {:?}", stage), + _ => panic!("Expected RequestExecuteStage::Completed, got {stage:?}"), } } else { panic!( diff --git a/core/station/impl/src/factories/requests/remove_user_group.rs b/core/station/impl/src/factories/requests/remove_user_group.rs index 9f9ecb081..b6524c846 100644 --- a/core/station/impl/src/factories/requests/remove_user_group.rs +++ b/core/station/impl/src/factories/requests/remove_user_group.rs @@ -48,7 +48,7 @@ impl Execute for RemoveUserGroupRequestExecute<'_, '_> { .remove(&self.operation.input.user_group_id) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to remove user group: {}", e), + reason: format!("Failed to remove user group: {e}"), })?; Ok(RequestExecuteStage::Completed( diff --git a/core/station/impl/src/factories/requests/system_upgrade.rs b/core/station/impl/src/factories/requests/system_upgrade.rs index a7a7d4685..a5adf2463 100644 --- a/core/station/impl/src/factories/requests/system_upgrade.rs +++ b/core/station/impl/src/factories/requests/system_upgrade.rs @@ -91,7 +91,7 @@ impl Execute for SystemUpgradeRequestExecute<'_, '_> { ) .await .map_err(|err| RequestExecuteError::Failed { - reason: format!("failed to upgrade station: {}", err), + reason: format!("failed to upgrade station: {err}"), }); if out.is_err() { diff --git a/core/station/impl/src/factories/requests/transfer.rs b/core/station/impl/src/factories/requests/transfer.rs index 98d2f4e19..8d225a038 100644 --- a/core/station/impl/src/factories/requests/transfer.rs +++ b/core/station/impl/src/factories/requests/transfer.rs @@ -33,13 +33,13 @@ impl Create for TransferRequestCreate { let from_account_id = HelperMapper::to_uuid(operation_input.from_account_id).map_err(|e| { RequestError::ValidationError { - info: format!("Invalid from_account_id: {}", e), + info: format!("Invalid from_account_id: {e}"), } })?; let from_asset_id = HelperMapper::to_uuid(operation_input.from_asset_id.clone()) .map_err(|e| RequestError::ValidationError { - info: format!("Invalid from_asset_id: {}", e), + info: format!("Invalid from_asset_id: {e}"), })? .as_bytes() .to_owned(); @@ -116,7 +116,7 @@ impl Execute for TransferRequestExecute<'_, '_> { let blockchain_api = BlockchainApiFactory::build(&asset.blockchain).map_err(|e| { RequestExecuteError::Failed { - reason: format!("Failed to build blockchain api: {}", e), + reason: format!("Failed to build blockchain api: {e}"), } })?; let fee = match &self.operation.input.fee { @@ -126,7 +126,7 @@ impl Execute for TransferRequestExecute<'_, '_> { .transaction_fee(&asset, self.operation.input.with_standard.clone()) .await .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to fetch transaction fee: {}", e), + reason: format!("Failed to fetch transaction fee: {e}"), })?; candid::Nat(transaction_fee.fee) @@ -148,7 +148,7 @@ impl Execute for TransferRequestExecute<'_, '_> { self.operation.input.network.clone(), )) .map_err(|e| RequestExecuteError::Failed { - reason: format!("Failed to validate transfer: {}", e), + reason: format!("Failed to validate transfer: {e}"), })?; Ok(RequestExecuteStage::Processing( diff --git a/core/station/impl/src/jobs/execute_created_transfers.rs b/core/station/impl/src/jobs/execute_created_transfers.rs index 383487896..e675b9439 100644 --- a/core/station/impl/src/jobs/execute_created_transfers.rs +++ b/core/station/impl/src/jobs/execute_created_transfers.rs @@ -216,7 +216,7 @@ impl Job { ( transfer.clone(), TransferError::ExecutionError { - reason: format!("Failed to build blockchain api: {}", e), + reason: format!("Failed to build blockchain api: {e}"), }, ) })?; diff --git a/core/station/impl/src/mappers/request_operation.rs b/core/station/impl/src/mappers/request_operation.rs index 81fb19009..5b2d3141a 100644 --- a/core/station/impl/src/mappers/request_operation.rs +++ b/core/station/impl/src/mappers/request_operation.rs @@ -1410,8 +1410,7 @@ impl From replace_snapshot: input.replace_snapshot.map(|snapshot_id| { hex::decode(&snapshot_id).unwrap_or_else(|err| { ic_cdk::trap(&format!( - "Failed to decode snapshot id {} to hex: {}", - snapshot_id, err + "Failed to decode snapshot id {snapshot_id} to hex: {err}" )) }) }), @@ -1489,8 +1488,7 @@ impl From for PruneExternalCanisterResource { PruneExternalCanisterResource::Snapshot(hex::decode(&snapshot_id).unwrap_or_else( |err| { ic_cdk::trap(&format!( - "Failed to convert snapshot id {} to hex: {}", - snapshot_id, err + "Failed to convert snapshot id {snapshot_id} to hex: {err}" )) }, )) diff --git a/core/station/impl/src/migration.rs b/core/station/impl/src/migration.rs index c75c3d9ed..c2d6107f3 100644 --- a/core/station/impl/src/migration.rs +++ b/core/station/impl/src/migration.rs @@ -27,15 +27,13 @@ impl MigrationHandler { if stored_version > STABLE_MEMORY_VERSION { trap(&format!( - "Cannot downgrade the station from memory layout version {} to {}", - stored_version, STABLE_MEMORY_VERSION + "Cannot downgrade the station from memory layout version {stored_version} to {STABLE_MEMORY_VERSION}" )); } if stored_version != STABLE_MEMORY_VERSION - 1 { trap(&format!( - "Cannot skip upgrades between station memory layout version {} to {}", - stored_version, STABLE_MEMORY_VERSION + "Cannot skip upgrades between station memory layout version {stored_version} to {STABLE_MEMORY_VERSION}" )); } diff --git a/core/station/impl/src/migration_tests/mod.rs b/core/station/impl/src/migration_tests/mod.rs index 585019e09..5d8132302 100644 --- a/core/station/impl/src/migration_tests/mod.rs +++ b/core/station/impl/src/migration_tests/mod.rs @@ -37,10 +37,7 @@ mod test { }); fs::write( - format!( - "src/migration_tests/snapshots/{}_v{}.bin", - label, STABLE_MEMORY_VERSION - ), + format!("src/migration_tests/snapshots/{label}_v{STABLE_MEMORY_VERSION}.bin"), snapshot, ) .unwrap(); diff --git a/core/station/impl/src/models/account.rs b/core/station/impl/src/models/account.rs index 7c5b3309e..e145fa0fc 100644 --- a/core/station/impl/src/models/account.rs +++ b/core/station/impl/src/models/account.rs @@ -178,7 +178,7 @@ fn validate_policy_id(policy_id: &UUID, field_name: &str) -> ModelValidatorResul REQUEST_POLICY_REPOSITORY .get(policy_id) .ok_or(AccountError::ValidationError { - info: format!("The {} does not exist", field_name), + info: format!("The {field_name} does not exist"), })?; Ok(()) } diff --git a/core/station/impl/src/models/metadata.rs b/core/station/impl/src/models/metadata.rs index 840640f8e..8f8ec2a20 100644 --- a/core/station/impl/src/models/metadata.rs +++ b/core/station/impl/src/models/metadata.rs @@ -89,7 +89,7 @@ impl Metadata { pub(crate) fn mock() -> Self { (0..Self::MAX_METADATA) .map(|i| MetadataDTO { - key: format!("{:0>24}", i), + key: format!("{i:0>24}"), value: "b".repeat(Self::MAX_METADATA_VALUE_LEN as usize), }) .collect::>() @@ -140,7 +140,7 @@ mod tests { fn fail_metadata_validation_too_many() { let metadata: Metadata = (0..Metadata::MAX_METADATA as usize + 1) .map(|i| MetadataDTO { - key: format!("{:0>24}", i), + key: format!("{i:0>24}"), value: "b".repeat(Metadata::MAX_METADATA_VALUE_LEN as usize), }) .collect::>() @@ -163,7 +163,7 @@ mod tests { fn fail_metadata_validation_key_too_long() { let metadata: Metadata = (0..Metadata::MAX_METADATA) .map(|i| MetadataDTO { - key: format!("{:0>25}", i), + key: format!("{i:0>25}"), value: "b".repeat(Metadata::MAX_METADATA_VALUE_LEN as usize), }) .collect::>() @@ -186,7 +186,7 @@ mod tests { fn fail_metadata_validation_value_too_long() { let metadata: Metadata = (0..Metadata::MAX_METADATA) .map(|i| MetadataDTO { - key: format!("{:0>24}", i), + key: format!("{i:0>24}"), value: "b".repeat(Metadata::MAX_METADATA_VALUE_LEN as usize + 1), }) .collect::>() diff --git a/core/station/impl/src/models/notification_type.rs b/core/station/impl/src/models/notification_type.rs index fc785eb55..d10282b3f 100644 --- a/core/station/impl/src/models/notification_type.rs +++ b/core/station/impl/src/models/notification_type.rs @@ -28,15 +28,15 @@ pub type RequestRejectedNotification = RequestNotification; impl Display for NotificationType { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - NotificationType::SystemMessage => write!(f, "{}", SYSTEM_MESSAGE_NOTIFICATION_TYPE), + NotificationType::SystemMessage => write!(f, "{SYSTEM_MESSAGE_NOTIFICATION_TYPE}"), NotificationType::RequestCreated(_) => { - write!(f, "{}", REQUEST_CREATED_NOTIFICATION_TYPE) + write!(f, "{REQUEST_CREATED_NOTIFICATION_TYPE}") } NotificationType::RequestFailed(_) => { - write!(f, "{}", REQUEST_FAILED_NOTIFICATION_TYPE) + write!(f, "{REQUEST_FAILED_NOTIFICATION_TYPE}") } NotificationType::RequestRejected(_) => { - write!(f, "{}", REQUEST_REJECTED_NOTIFICATION_TYPE) + write!(f, "{REQUEST_REJECTED_NOTIFICATION_TYPE}") } } } diff --git a/core/station/impl/src/models/request.rs b/core/station/impl/src/models/request.rs index daa14ac23..5d4b1a5d1 100644 --- a/core/station/impl/src/models/request.rs +++ b/core/station/impl/src/models/request.rs @@ -380,8 +380,7 @@ impl Request { Ok(has_approval_right) => has_approval_right, Err(_) => { print(format!( - "Failed to evaluate voting rights for request: {:?}", - self + "Failed to evaluate voting rights for request: {self:?}" )); false @@ -736,7 +735,7 @@ mod tests { fn fail_request_tags_too_many() { let mut request = mock_request(); for i in 0..Request::MAX_TAGS_LEN as usize + 1 { - request.tags.push(format!("tag{}", i)); + request.tags.push(format!("tag{i}")); } let result = validate_tags(&request.tags); diff --git a/core/station/impl/src/models/request_operation.rs b/core/station/impl/src/models/request_operation.rs index 95fe2fbec..ca1eaf402 100644 --- a/core/station/impl/src/models/request_operation.rs +++ b/core/station/impl/src/models/request_operation.rs @@ -1813,7 +1813,7 @@ mod test { assert_eq!(provided, max_backup_snapshots); assert_eq!(limit, ICP_MAX_CANISTER_SNAPSHOTS); } - _ => panic!("Unexpected error: {:?}", err), + _ => panic!("Unexpected error: {err:?}"), }; let err = RequestOperation::ManageSystemInfo(crate::models::ManageSystemInfoOperation { diff --git a/core/station/impl/src/models/request_policy_rule.rs b/core/station/impl/src/models/request_policy_rule.rs index 9cdfc521c..1ba14b158 100644 --- a/core/station/impl/src/models/request_policy_rule.rs +++ b/core/station/impl/src/models/request_policy_rule.rs @@ -505,8 +505,7 @@ impl match account { Err(e) => { print(format!( - "Rule rejected due to account not being found: {:?}", - e + "Rule rejected due to account not being found: {e:?}" )); return Ok(RequestPolicyRuleResult { diff --git a/core/station/impl/src/models/resource.rs b/core/station/impl/src/models/resource.rs index a394579c9..55b45fe34 100644 --- a/core/station/impl/src/models/resource.rs +++ b/core/station/impl/src/models/resource.rs @@ -736,20 +736,20 @@ impl Resource { impl Display for Resource { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - Resource::Permission(action) => write!(f, "Permission({})", action), - Resource::Account(action) => write!(f, "Account({})", action), - Resource::AddressBook(action) => write!(f, "AddressBook({})", action), + Resource::Permission(action) => write!(f, "Permission({action})"), + Resource::Account(action) => write!(f, "Account({action})"), + Resource::AddressBook(action) => write!(f, "AddressBook({action})"), Resource::ExternalCanister(action) => { - write!(f, "ExternalCanister({})", action) + write!(f, "ExternalCanister({action})") } - Resource::Notification(action) => write!(f, "Notification({})", action), - Resource::Request(action) => write!(f, "Request({})", action), - Resource::RequestPolicy(action) => write!(f, "RequestPolicy({})", action), - Resource::System(action) => write!(f, "System({})", action), - Resource::User(action) => write!(f, "User({})", action), - Resource::UserGroup(action) => write!(f, "UserGroup({})", action), - Resource::Asset(action) => write!(f, "Asset({})", action), - Resource::NamedRule(action) => write!(f, "NamedRule({})", action), + Resource::Notification(action) => write!(f, "Notification({action})"), + Resource::Request(action) => write!(f, "Request({action})"), + Resource::RequestPolicy(action) => write!(f, "RequestPolicy({action})"), + Resource::System(action) => write!(f, "System({action})"), + Resource::User(action) => write!(f, "User({action})"), + Resource::UserGroup(action) => write!(f, "UserGroup({action})"), + Resource::Asset(action) => write!(f, "Asset({action})"), + Resource::NamedRule(action) => write!(f, "NamedRule({action})"), } } } @@ -759,9 +759,9 @@ impl Display for ResourceAction { match self { ResourceAction::List => write!(f, "List"), ResourceAction::Create => write!(f, "Create"), - ResourceAction::Read(id) => write!(f, "Read({})", id), - ResourceAction::Update(id) => write!(f, "Update({})", id), - ResourceAction::Delete(id) => write!(f, "Delete({})", id), + ResourceAction::Read(id) => write!(f, "Read({id})"), + ResourceAction::Update(id) => write!(f, "Update({id})"), + ResourceAction::Delete(id) => write!(f, "Delete({id})"), } } } @@ -780,9 +780,9 @@ impl Display for AccountResourceAction { match self { AccountResourceAction::List => write!(f, "List"), AccountResourceAction::Create => write!(f, "Create"), - AccountResourceAction::Transfer(id) => write!(f, "Transfer({})", id), - AccountResourceAction::Read(id) => write!(f, "Read({})", id), - AccountResourceAction::Update(id) => write!(f, "Update({})", id), + AccountResourceAction::Transfer(id) => write!(f, "Transfer({id})"), + AccountResourceAction::Read(id) => write!(f, "Read({id})"), + AccountResourceAction::Update(id) => write!(f, "Update({id})"), } } } @@ -792,7 +792,7 @@ impl Display for ExternalCanisterId { match self { ExternalCanisterId::Any => write!(f, "Any"), ExternalCanisterId::Canister(canister_id) => { - write!(f, "Canister({})", canister_id) + write!(f, "Canister({canister_id})") } } } @@ -804,16 +804,16 @@ impl Display for ExternalCanisterResourceAction { ExternalCanisterResourceAction::List => write!(f, "List"), ExternalCanisterResourceAction::Create => write!(f, "Create"), ExternalCanisterResourceAction::Change(target) => { - write!(f, "Change({})", target) + write!(f, "Change({target})") } ExternalCanisterResourceAction::Fund(target) => { - write!(f, "Fund({})", target) + write!(f, "Fund({target})") } ExternalCanisterResourceAction::Call(target) => { - write!(f, "Call({})", target) + write!(f, "Call({target})") } ExternalCanisterResourceAction::Read(target) => { - write!(f, "Read({})", target) + write!(f, "Read({target})") } } } @@ -824,7 +824,7 @@ impl Display for NotificationResourceAction { match self { NotificationResourceAction::List => write!(f, "List"), NotificationResourceAction::Update(id) => { - write!(f, "Update({})", id) + write!(f, "Update({id})") } } } @@ -845,7 +845,7 @@ impl Display for ValidationMethodResourceTarget { match self { ValidationMethodResourceTarget::No => write!(f, "NoValidationMethod"), ValidationMethodResourceTarget::ValidationMethod(canister_method) => { - write!(f, "ValidationMethod({})", canister_method) + write!(f, "ValidationMethod({canister_method})") } } } @@ -856,7 +856,7 @@ impl Display for ExecutionMethodResourceTarget { match self { ExecutionMethodResourceTarget::Any => write!(f, "AnyExecutionMethod"), ExecutionMethodResourceTarget::ExecutionMethod(canister_method) => { - write!(f, "ExecutionMethod({})", canister_method) + write!(f, "ExecutionMethod({canister_method})") } } } @@ -876,7 +876,7 @@ impl Display for RequestResourceAction { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { RequestResourceAction::List => write!(f, "List"), - RequestResourceAction::Read(id) => write!(f, "Read({})", id), + RequestResourceAction::Read(id) => write!(f, "Read({id})"), } } } @@ -897,8 +897,8 @@ impl Display for UserResourceAction { match self { UserResourceAction::List => write!(f, "List"), UserResourceAction::Create => write!(f, "Create"), - UserResourceAction::Read(id) => write!(f, "Read({})", id), - UserResourceAction::Update(id) => write!(f, "Update({})", id), + UserResourceAction::Read(id) => write!(f, "Read({id})"), + UserResourceAction::Update(id) => write!(f, "Update({id})"), } } } diff --git a/core/station/impl/src/models/transfer.rs b/core/station/impl/src/models/transfer.rs index d6eea5ab1..fd91d596c 100644 --- a/core/station/impl/src/models/transfer.rs +++ b/core/station/impl/src/models/transfer.rs @@ -187,19 +187,19 @@ impl ModelValidator for Transfer { EnsureUser::id_exists(&self.initiator_user).map_err(|err| match err { RecordValidationError::NotFound { id, .. } => TransferError::ValidationError { - info: format!("The initiator_user {} does not exist", id), + info: format!("The initiator_user {id} does not exist"), }, })?; EnsureAccount::id_exists(&self.from_account).map_err(|err| match err { RecordValidationError::NotFound { id, .. } => TransferError::ValidationError { - info: format!("The from_account {} does not exist", id), + info: format!("The from_account {id} does not exist"), }, })?; EnsureRequest::id_exists(&self.request_id).map_err(|err| match err { RecordValidationError::NotFound { id, .. } => TransferError::ValidationError { - info: format!("The request_id {} does not exist", id), + info: format!("The request_id {id} does not exist"), }, })?; diff --git a/core/station/impl/src/models/user.rs b/core/station/impl/src/models/user.rs index fcf4fb9c7..f80dfde22 100644 --- a/core/station/impl/src/models/user.rs +++ b/core/station/impl/src/models/user.rs @@ -222,7 +222,7 @@ mod tests { UserGroup { id, last_modification_timestamp: 0, - name: format!("group_{}", i), + name: format!("group_{i}"), }, ); id @@ -303,7 +303,7 @@ pub mod user_test_utils { id, identities: vec![identity], groups: vec![], - name: format!("user_{}", uuid), + name: format!("user_{uuid}"), status: UserStatus::Active, last_modification_timestamp: 0, } diff --git a/core/station/impl/src/repositories/external_canister.rs b/core/station/impl/src/repositories/external_canister.rs index f4303e715..888153036 100644 --- a/core/station/impl/src/repositories/external_canister.rs +++ b/core/station/impl/src/repositories/external_canister.rs @@ -274,7 +274,7 @@ mod tests { let repository = ExternalCanisterRepository::default(); for i in 0..10 { let mut entry = mock_external_canister(); - entry.name = format!("test-{}", i); + entry.name = format!("test-{i}"); repository.insert(entry.key(), entry); } diff --git a/core/station/impl/src/repositories/indexes/request_policy_resource_index.rs b/core/station/impl/src/repositories/indexes/request_policy_resource_index.rs index f7a79218f..658d9c87d 100644 --- a/core/station/impl/src/repositories/indexes/request_policy_resource_index.rs +++ b/core/station/impl/src/repositories/indexes/request_policy_resource_index.rs @@ -340,7 +340,7 @@ mod tests { execution_method: ExecutionMethodResourceTarget::ExecutionMethod( CanisterMethod { canister_id: Principal::from_slice(&[i % 2; 29]), - method_name: format!("method_{}", i), + method_name: format!("method_{i}"), }, ), validation_method: ValidationMethodResourceTarget::No, @@ -368,7 +368,7 @@ mod tests { execution_method: ExecutionMethodResourceTarget::ExecutionMethod( CanisterMethod { canister_id: Principal::management_canister(), - method_name: format!("method_{}", i), + method_name: format!("method_{i}"), }, ), validation_method: if i % 2 == 0 { @@ -376,7 +376,7 @@ mod tests { } else { ValidationMethodResourceTarget::ValidationMethod(CanisterMethod { canister_id: Principal::management_canister(), - method_name: format!("validation_method_{}", i), + method_name: format!("validation_method_{i}"), }) }, }, @@ -394,7 +394,7 @@ mod tests { for i in 0..20 { let policies = repository.find_external_canister_call_policies_by_execution_method( &Principal::management_canister(), - &format!("method_{}", i), + &format!("method_{i}"), ); let expected_method_id = expected_method_ids.pop().unwrap(); @@ -407,7 +407,7 @@ mod tests { } else { ValidationMethodResourceTarget::ValidationMethod(CanisterMethod { canister_id: Principal::management_canister(), - method_name: format!("validation_method_{}", i), + method_name: format!("validation_method_{i}"), }) }; @@ -415,7 +415,7 @@ mod tests { let policies = repository .find_external_canister_call_policies_by_execution_and_validation_method( &Principal::management_canister(), - &format!("method_{}", i), + &format!("method_{i}"), &validation_method, ); diff --git a/core/station/impl/src/repositories/indexes/transfer_account_index.rs b/core/station/impl/src/repositories/indexes/transfer_account_index.rs index ce77ff512..69269c889 100644 --- a/core/station/impl/src/repositories/indexes/transfer_account_index.rs +++ b/core/station/impl/src/repositories/indexes/transfer_account_index.rs @@ -63,7 +63,7 @@ impl IndexRepository for TransferAccountIndexR }; if from_dt > to_dt { - print(format!("Invalid TransferAccountIndexRepository::FindByCriteria: from_dt {} is greater than to_dt {}", from_dt, to_dt)); + print(format!("Invalid TransferAccountIndexRepository::FindByCriteria: from_dt {from_dt} is greater than to_dt {to_dt}")); return HashSet::new(); } diff --git a/core/station/impl/src/repositories/permission.rs b/core/station/impl/src/repositories/permission.rs index 4a1c2dffd..6ef4ab1f8 100644 --- a/core/station/impl/src/repositories/permission.rs +++ b/core/station/impl/src/repositories/permission.rs @@ -279,7 +279,7 @@ mod tests { execution_method: ExecutionMethodResourceTarget::ExecutionMethod( CanisterMethod { canister_id, - method_name: format!("method_{}", method_nr), + method_name: format!("method_{method_nr}"), }, ), validation_method: ValidationMethodResourceTarget::No, @@ -294,13 +294,13 @@ mod tests { execution_method: ExecutionMethodResourceTarget::ExecutionMethod( CanisterMethod { canister_id, - method_name: format!("method_{}", method_nr), + method_name: format!("method_{method_nr}"), }, ), validation_method: ValidationMethodResourceTarget::ValidationMethod( CanisterMethod { canister_id, - method_name: format!("method_{}", method_nr), + method_name: format!("method_{method_nr}"), }, ), }, diff --git a/core/station/impl/src/services/cycle_manager.rs b/core/station/impl/src/services/cycle_manager.rs index 427fd9b53..1ba091663 100644 --- a/core/station/impl/src/services/cycle_manager.rs +++ b/core/station/impl/src/services/cycle_manager.rs @@ -65,8 +65,7 @@ impl CycleManager { }); ic_cdk::print(format!( - "Cycle manager: canister {} added to cycle monitoring.", - canister_id + "Cycle manager: canister {canister_id} added to cycle monitoring." )); } @@ -80,8 +79,7 @@ impl CycleManager { }); ic_cdk::print(format!( - "Cycle manager: canister {} removed from cycle monitoring.", - canister_id + "Cycle manager: canister {canister_id} removed from cycle monitoring." )); } @@ -102,8 +100,7 @@ impl CycleManager { }); ic_cdk::print(format!( - "Cycle manager: obtain cycles strategy changed to {:?}.", - strategy + "Cycle manager: obtain cycles strategy changed to {strategy:?}." )); } } diff --git a/core/station/impl/src/services/disaster_recovery.rs b/core/station/impl/src/services/disaster_recovery.rs index 86f1e763d..ccfbdea14 100644 --- a/core/station/impl/src/services/disaster_recovery.rs +++ b/core/station/impl/src/services/disaster_recovery.rs @@ -99,10 +99,10 @@ impl DisasterRecoveryService { pub async fn sync_all(&self) { if let Err(error) = DISASTER_RECOVERY_SERVICE.sync_committee().await { - crate::core::ic_cdk::api::print(format!("Failed to sync committee: {}", error,)); + crate::core::ic_cdk::api::print(format!("Failed to sync committee: {error}",)); } if let Err(error) = DISASTER_RECOVERY_SERVICE.sync_accounts_and_assets().await { - crate::core::ic_cdk::api::print(format!("Failed to sync accounts: {}", error,)); + crate::core::ic_cdk::api::print(format!("Failed to sync accounts: {error}",)); } } } @@ -136,8 +136,7 @@ pub fn disaster_recovery_observes_insert_user(observer: &mut Observer<(User, Opt crate::core::ic_cdk::spawn(async { if let Err(error) = DISASTER_RECOVERY_SERVICE.sync_committee().await { crate::core::ic_cdk::api::print(format!( - "Failed to sync committee: {}", - error, + "Failed to sync committee: {error}", )); } }); @@ -166,8 +165,7 @@ pub fn disaster_recovery_observes_remove_user(observer: &mut Observer) { crate::core::ic_cdk::spawn(async { if let Err(error) = DISASTER_RECOVERY_SERVICE.sync_committee().await { crate::core::ic_cdk::api::print(format!( - "Failed to sync committee: {}", - error, + "Failed to sync committee: {error}", )); } }); @@ -196,8 +194,7 @@ pub fn disaster_recovery_sync_accounts_and_assets_on_remove(observer: &mut Obser crate::core::ic_cdk::spawn(async { if let Err(error) = DISASTER_RECOVERY_SERVICE.sync_accounts_and_assets().await { crate::core::ic_cdk::api::print(format!( - "Failed to sync accounts and assets: {}", - error, + "Failed to sync accounts and assets: {error}", )); } }); @@ -260,8 +257,7 @@ where crate::core::ic_cdk::spawn(async { if let Err(error) = DISASTER_RECOVERY_SERVICE.sync_accounts_and_assets().await { crate::core::ic_cdk::api::print(format!( - "Failed to sync accounts and assets: {}", - error, + "Failed to sync accounts and assets: {error}", )); } }); diff --git a/core/station/impl/src/services/external_canister.rs b/core/station/impl/src/services/external_canister.rs index 428028b12..69920387f 100644 --- a/core/station/impl/src/services/external_canister.rs +++ b/core/station/impl/src/services/external_canister.rs @@ -1245,7 +1245,7 @@ impl ExternalCanisterService { .is_unique_name(name, skip_id) { Err(ExternalCanisterError::ValidationError { - info: format!("The name '{}' is already in use.", name), + info: format!("The name '{name}' is already in use."), })?; } @@ -1265,7 +1265,7 @@ impl ExternalCanisterService { .is_unique_canister_id(canister_id, skip_id) { Err(ExternalCanisterError::ValidationError { - info: format!("The canister id '{}' is already in use.", canister_id), + info: format!("The canister id '{canister_id}' is already in use."), })?; } @@ -1685,7 +1685,7 @@ mod tests { for i in 0..2 { let result = EXTERNAL_CANISTER_SERVICE .add_external_canister(CreateExternalCanisterOperationInput { - name: format!("test{}", i), + name: format!("test{i}"), description: None, labels: None, metadata: None, @@ -2133,7 +2133,7 @@ mod tests { for i in 0..2 { let _ = EXTERNAL_CANISTER_SERVICE .add_external_canister(CreateExternalCanisterOperationInput { - name: format!("test{}", i), + name: format!("test{i}"), description: None, labels: None, metadata: None, @@ -2186,7 +2186,7 @@ mod tests { for i in 0..2 { let _ = EXTERNAL_CANISTER_SERVICE .add_external_canister(CreateExternalCanisterOperationInput { - name: format!("test{}", i), + name: format!("test{i}"), description: None, labels: None, metadata: None, @@ -2298,7 +2298,7 @@ mod tests { external_canisters.push( EXTERNAL_CANISTER_SERVICE .add_external_canister(CreateExternalCanisterOperationInput { - name: format!("test{}", i), + name: format!("test{i}"), description: None, labels: None, metadata: None, diff --git a/core/station/impl/src/services/request.rs b/core/station/impl/src/services/request.rs index 65bbada09..bac89216c 100644 --- a/core/station/impl/src/services/request.rs +++ b/core/station/impl/src/services/request.rs @@ -520,7 +520,7 @@ impl RequestService { return Err(RequestExecuteError::ValidationError { info }); } _ => { - let reason = format!("Unexpected validation result: {:?}", err); + let reason = format!("Unexpected validation result: {err:?}"); return Err(RequestExecuteError::InternalError { reason }); } } diff --git a/core/station/impl/src/services/request_policy.rs b/core/station/impl/src/services/request_policy.rs index 7e26733dc..89896f8ac 100644 --- a/core/station/impl/src/services/request_policy.rs +++ b/core/station/impl/src/services/request_policy.rs @@ -103,8 +103,7 @@ impl RequestPolicyService { self.remove_request_policy(existing_policy_id) { print(format!( - "Cannot handle policy change: policy {} not found", - id + "Cannot handle policy change: policy {id} not found" )); } diff --git a/core/station/impl/src/services/system.rs b/core/station/impl/src/services/system.rs index 8e550ccbc..755ada0e4 100644 --- a/core/station/impl/src/services/system.rs +++ b/core/station/impl/src/services/system.rs @@ -305,7 +305,7 @@ impl SystemService { async fn initialize_rng_timer() { use orbit_essentials::utils::initialize_rng; if let Err(e) = initialize_rng().await { - ic_cdk::print(format!("initializing rng failed: {}", e)); + ic_cdk::print(format!("initializing rng failed: {e}")); crate::core::ic_timers::set_timer(std::time::Duration::from_secs(60), move || { use crate::core::ic_cdk::spawn; spawn(initialize_rng_timer()) @@ -463,7 +463,7 @@ impl SystemService { if let Err(e) = install_canister_post_process_work(init.clone(), system_info.clone()).await { - ic_cdk::print(format!("canister initialization failed: {}", e)); + ic_cdk::print(format!("canister initialization failed: {e}")); crate::core::ic_timers::set_timer( std::time::Duration::from_secs(3600), move || { @@ -488,7 +488,7 @@ impl SystemService { // synchronously via a system API. let station_cycles = canister_balance128(); if station_cycles < upgrader_initial_cycles { - ic_cdk::trap(&format!("Station cycles balance {} is insufficient for transferring {} cycles when deploying the upgrader.", station_cycles, upgrader_initial_cycles)); + ic_cdk::trap(&format!("Station cycles balance {station_cycles} is insufficient for transferring {upgrader_initial_cycles} cycles when deploying the upgrader.")); } } }; @@ -1152,13 +1152,13 @@ mod init_canister_sync_handlers { Ok((input, account_id)) }) .collect::)>, ApiError>>() - .map_err(|e| format!("Invalid input: {:?}", e))?; + .map_err(|e| format!("Invalid input: {e:?}"))?; for (new_account, with_account_id) in add_accounts { ACCOUNT_SERVICE .create_account(new_account, with_account_id) .await - .map_err(|e| format!("Failed to add account: {:?}", e))?; + .map_err(|e| format!("Failed to add account: {e:?}"))?; print("account created"); } @@ -1195,7 +1195,7 @@ mod install_canister_handlers { }, }) .await - .map_err(|e| format!("Failed to set upgrader controller: {:?}", e))?; + .map_err(|e| format!("Failed to set upgrader controller: {e:?}"))?; Ok(upgrader_id) } @@ -1229,7 +1229,7 @@ mod install_canister_handlers { initial_upgrader_cycles, ) .await - .map_err(|e| format!("Failed to create upgrader canister: {:?}", e))?; + .map_err(|e| format!("Failed to create upgrader canister: {e:?}"))?; mgmt::install_code(mgmt::InstallCodeArgument { mode: mgmt::CanisterInstallMode::Install, @@ -1241,7 +1241,7 @@ mod install_canister_handlers { .expect("Failed to encode upgrader init arg"), }) .await - .map_err(|e| format!("Failed to install upgrader canister: {:?}", e))?; + .map_err(|e| format!("Failed to install upgrader canister: {e:?}"))?; Ok(upgrader_canister.canister_id) } @@ -1256,7 +1256,7 @@ mod install_canister_handlers { }, }) .await - .map_err(|e| format!("Failed to set station controller: {:?}", e)) + .map_err(|e| format!("Failed to set station controller: {e:?}")) } /// Starts the fund manager service setting it up to monitor the upgrader canister cycles and top it up if needed. diff --git a/core/upgrader/impl/src/lib.rs b/core/upgrader/impl/src/lib.rs index 2a45935eb..f88ad0b1c 100644 --- a/core/upgrader/impl/src/lib.rs +++ b/core/upgrader/impl/src/lib.rs @@ -195,8 +195,7 @@ async fn set_max_backup_snapshots(max_backup_snapshots: u64) -> Result<(), Strin let id = get_target_canister(); if ic_cdk::caller() != id { return Err(format!( - "Only the target canister {} is authorized to call `set_max_backup_snapshots`.", - id + "Only the target canister {id} is authorized to call `set_max_backup_snapshots`." )); } diff --git a/core/upgrader/impl/src/model/logging.rs b/core/upgrader/impl/src/model/logging.rs index 5dec61f73..b01be6702 100644 --- a/core/upgrader/impl/src/model/logging.rs +++ b/core/upgrader/impl/src/model/logging.rs @@ -57,7 +57,7 @@ impl std::fmt::Display for RequestDisasterRecoveryPruneLog { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { RequestDisasterRecoveryPruneLog::Snapshot(snapshot_id) => { - write!(f, "snapshot_id {}", snapshot_id) + write!(f, "snapshot_id {snapshot_id}") } RequestDisasterRecoveryPruneLog::ChunkStore => { write!(f, "chunk store") @@ -99,7 +99,7 @@ impl std::fmt::Display for RequestDisasterRecoveryOperationLog { write!(f, "Restore snapshot_id {}", snapshot.snapshot_id,) } RequestDisasterRecoveryOperationLog::Prune(prune) => { - write!(f, "Prune {}", prune) + write!(f, "Prune {prune}") } RequestDisasterRecoveryOperationLog::Start => { write!(f, "Start") @@ -202,7 +202,7 @@ impl LogEntryType { }, LogEntryType::UpgradeResult(data) => match data { UpgradeResultLog::Success => "Upgrade succeeded".to_owned(), - UpgradeResultLog::Failure(ref reason) => format!("Upgrade failed: {}", reason), + UpgradeResultLog::Failure(ref reason) => format!("Upgrade failed: {reason}"), }, LogEntryType::DisasterRecoveryInProgress(data) => { format!( @@ -238,7 +238,7 @@ impl LogEntryType { LogEntryType::DisasterRecoveryInProgressExpired(data) => serde_json::to_string(data), LogEntryType::SetAccountsAndAssets(data) => serde_json::to_string(data), } - .map_err(|err| format!("Failed to serialize log entry: {}", err)) + .map_err(|err| format!("Failed to serialize log entry: {err}")) } } diff --git a/core/upgrader/impl/src/services/install_canister.rs b/core/upgrader/impl/src/services/install_canister.rs index bc7a903ab..cbc7885dd 100644 --- a/core/upgrader/impl/src/services/install_canister.rs +++ b/core/upgrader/impl/src/services/install_canister.rs @@ -91,7 +91,7 @@ impl InstallCanister for StationDisasterRecoveryInstall { arg, ) .await - .map_err(|err| format!("failed to {} canister: \"{}\"", mode, err,)) + .map_err(|err| format!("failed to {mode} canister: \"{err}\"",)) } async fn start(&self, canister_id: Principal) -> Result<(), String> { diff --git a/core/upgrader/impl/src/services/logger.rs b/core/upgrader/impl/src/services/logger.rs index 65d995c4d..9783e9ea7 100644 --- a/core/upgrader/impl/src/services/logger.rs +++ b/core/upgrader/impl/src/services/logger.rs @@ -51,7 +51,7 @@ impl LoggerService { /// Logs an entry to the storage. If it cannot log the entry, it prints to the canister's logs. pub fn log(&self, entry_type: LogEntryType) { if let Err(err) = self.try_log(entry_type) { - crate::upgrader_ic_cdk::api::print(format!("Failed to log entry: {}", err)); + crate::upgrader_ic_cdk::api::print(format!("Failed to log entry: {err}")); } } diff --git a/core/upgrader/impl/src/upgrade.rs b/core/upgrader/impl/src/upgrade.rs index 452ecaefb..cd2f3f321 100644 --- a/core/upgrader/impl/src/upgrade.rs +++ b/core/upgrader/impl/src/upgrade.rs @@ -180,7 +180,7 @@ impl Upgrade for WithBackground { .map(|r| r.0); // Log an error if the notification can't be made. if let Err(e) = notify_res { - print(format!("notify_failed_station_upgrade failed: {:?}", e)); + print(format!("notify_failed_station_upgrade failed: {e:?}")); } } } diff --git a/libs/orbit-essentials-macros/src/macros/storable.rs b/libs/orbit-essentials-macros/src/macros/storable.rs index b778bbc4b..7d7a1553e 100644 --- a/libs/orbit-essentials-macros/src/macros/storable.rs +++ b/libs/orbit-essentials-macros/src/macros/storable.rs @@ -258,7 +258,7 @@ impl std::str::FromStr for SerializerFormat { match s { "candid" => Ok(Self::Candid), "cbor" => Ok(Self::Cbor), - _ => Err(format!("Unknown serializer format \"{}\"", s)), + _ => Err(format!("Unknown serializer format \"{s}\"")), } } } diff --git a/libs/orbit-essentials/src/api.rs b/libs/orbit-essentials/src/api.rs index 2564b76ba..cf45af4cc 100644 --- a/libs/orbit-essentials/src/api.rs +++ b/libs/orbit-essentials/src/api.rs @@ -74,7 +74,7 @@ impl From for ApiError { } pub fn extract_error_enum_variant_name(err: &E) -> String { - let full_code = to_snake_case(format!("{:?}", err)).to_uppercase(); + let full_code = to_snake_case(format!("{err:?}")).to_uppercase(); full_code .split(['{', '(']) .next() diff --git a/libs/orbit-essentials/src/install_chunked_code.rs b/libs/orbit-essentials/src/install_chunked_code.rs index 8f4118c64..759eb88a5 100644 --- a/libs/orbit-essentials/src/install_chunked_code.rs +++ b/libs/orbit-essentials/src/install_chunked_code.rs @@ -92,8 +92,7 @@ async fn fetch_extra_chunks( let res_len: candid::Nat = res.len().into(); match res_len.cmp(&asset.total_length) { std::cmp::Ordering::Less => Err(format!( - "The total number of wasm chunks must not exceed {}", - MAX_WASM_CHUNK_CNT + "The total number of wasm chunks must not exceed {MAX_WASM_CHUNK_CNT}" )), std::cmp::Ordering::Equal => Ok(res), std::cmp::Ordering::Greater => Err(format!( diff --git a/libs/orbit-essentials/src/metrics.rs b/libs/orbit-essentials/src/metrics.rs index a48258c2f..fcfc83f6f 100644 --- a/libs/orbit-essentials/src/metrics.rs +++ b/libs/orbit-essentials/src/metrics.rs @@ -204,7 +204,7 @@ impl MetricsRegistry { body: metrics, }, Err(err) => { - print(format!("Error exporting metrics: {:?}", err)); + print(format!("Error exporting metrics: {err:?}")); HttpResponse { status_code: 500, diff --git a/libs/orbit-essentials/src/utils/cycles.rs b/libs/orbit-essentials/src/utils/cycles.rs index 133943b6a..dbbff0fbd 100644 --- a/libs/orbit-essentials/src/utils/cycles.rs +++ b/libs/orbit-essentials/src/utils/cycles.rs @@ -15,8 +15,7 @@ pub async fn check_balance_before_transfer(transfer_amount: u128) -> Result<(), status.idle_cycles_burned_per_day * status.settings.freezing_threshold * 2_u64 / 86_400u64; if canister_balance() < min_balance + transfer_amount { let err = format!( - "Canister {} has insufficient cycles balance to transfer {} cycles.", - self_id, transfer_amount + "Canister {self_id} has insufficient cycles balance to transfer {transfer_amount} cycles." ); return Err(err); } diff --git a/libs/orbit-essentials/src/utils/lock.rs b/libs/orbit-essentials/src/utils/lock.rs index eaa8fc04d..ea1343978 100644 --- a/libs/orbit-essentials/src/utils/lock.rs +++ b/libs/orbit-essentials/src/utils/lock.rs @@ -55,7 +55,7 @@ impl CallerGuard { return None; } else { // Lock has expired, fall through to update the lock. - crate::cdk::api::print(format!("Lock has expired for {:?}", lock)); + crate::cdk::api::print(format!("Lock has expired for {lock:?}")); pending_requests.remove(&lock); } } else { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 569146d08..4dc6c359a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.87.0" +channel = "1.88.0" targets = ["wasm32-unknown-unknown"] components = ["rustfmt", "clippy"] diff --git a/tests/integration/build.rs b/tests/integration/build.rs index 329718103..35028b719 100644 --- a/tests/integration/build.rs +++ b/tests/integration/build.rs @@ -10,6 +10,6 @@ fn main() { ]; for (key, value) in env_vars { - println!("cargo:rustc-env={}={}", key, value); + println!("cargo:rustc-env={key}={value}"); } } diff --git a/tests/integration/src/control_panel_tests.rs b/tests/integration/src/control_panel_tests.rs index 9af30575c..2a5184053 100644 --- a/tests/integration/src/control_panel_tests.rs +++ b/tests/integration/src/control_panel_tests.rs @@ -565,7 +565,7 @@ fn insufficient_control_panel_cycles() { // deploy station let deploy_station_args = DeployStationInput { - name: format!("station_{}", i), + name: format!("station_{i}"), admins: vec![DeployStationAdminUserInput { identity: user_id, username: "admin".to_string(), @@ -681,8 +681,7 @@ fn deploy_station_with_insufficient_cycles() { ) .unwrap_err(); assert!(err.reject_message.contains(&format!( - "insufficient for transferring {} cycles when deploying the upgrader", - upgrader_initial_cycles + "insufficient for transferring {upgrader_initial_cycles} cycles when deploying the upgrader" ))); let cycles_after_failed_install = env.cycle_balance(station); assert!(cycles_before_install <= cycles_after_failed_install + 50_000_000_000); @@ -833,7 +832,7 @@ fn deploy_station( i: usize, ) -> ApiResult { let deploy_station_args = DeployStationInput { - name: format!("station_{}_{}_{}", user_id, day, i), + name: format!("station_{user_id}_{day}_{i}"), admins: vec![DeployStationAdminUserInput { identity: user_id, username: "admin".to_string(), diff --git a/tests/integration/src/cycles_monitor_tests.rs b/tests/integration/src/cycles_monitor_tests.rs index 00f5a648e..8f3419435 100644 --- a/tests/integration/src/cycles_monitor_tests.rs +++ b/tests/integration/src/cycles_monitor_tests.rs @@ -156,10 +156,7 @@ fn successful_monitors_stations_and_tops_up() { let cycles_balance = env.cycle_balance(newly_created_user_station); if cycles_balance <= 125_000_000_000 { - panic!( - "Cycles balance is too low to run the test, cycles_balance: {}", - cycles_balance - ); + panic!("Cycles balance is too low to run the test, cycles_balance: {cycles_balance}"); } advance_time_to_burn_cycles( diff --git a/tests/integration/src/dfx_orbit/setup.rs b/tests/integration/src/dfx_orbit/setup.rs index f0513045d..a5f7a50aa 100644 --- a/tests/integration/src/dfx_orbit/setup.rs +++ b/tests/integration/src/dfx_orbit/setup.rs @@ -196,7 +196,7 @@ pub(super) async fn setup_dfx_orbit(station_id: Principal) -> DfxOrbit { name: String::from("Test"), station_id, network: String::from("test"), - url: format!("http://localhost:{}", port), + url: format!("http://localhost:{port}"), }; DfxOrbit::new(orbit_agent, config, None, logger) .await diff --git a/tests/integration/src/dfx_orbit/util.rs b/tests/integration/src/dfx_orbit/util.rs index b5946b885..1778e2e19 100644 --- a/tests/integration/src/dfx_orbit/util.rs +++ b/tests/integration/src/dfx_orbit/util.rs @@ -37,7 +37,7 @@ pub(super) async fn poll_request_completion( RequestStatusDTO::Rejected | RequestStatusDTO::Cancelled { .. } | RequestStatusDTO::Failed { .. } => { - panic!("Expected request {} to succeed", request_id) + panic!("Expected request {request_id} to succeed") } RequestStatusDTO::Approved | RequestStatusDTO::Created @@ -46,7 +46,7 @@ pub(super) async fn poll_request_completion( } if Instant::now() > timeout { - panic!("Waiting for request {} to succeed timed out", request_id); + panic!("Waiting for request {request_id} to succeed timed out"); } tokio::time::sleep(Duration::from_secs(1)).await @@ -59,10 +59,7 @@ pub(super) async fn poll_request_completion( /// resource being fetched. pub(super) async fn fetch_asset(canister_id: Principal, path: &str) -> Vec { let port = PORT.with(|port| *port.borrow()); - let local_url = format!( - "http://localhost:{}/{}?canisterId={}", - port, path, canister_id - ); + let local_url = format!("http://localhost:{port}/{path}?canisterId={canister_id}"); reqwest::Client::new() .get(local_url) diff --git a/tests/integration/src/disaster_recovery_tests.rs b/tests/integration/src/disaster_recovery_tests.rs index 3d31981c6..51086cb38 100644 --- a/tests/integration/src/disaster_recovery_tests.rs +++ b/tests/integration/src/disaster_recovery_tests.rs @@ -50,10 +50,7 @@ fn await_disaster_recovery_success(env: &PocketIc, station_id: Principal, upgrad return; } } - panic!( - "Disaster recovery did not succeed within {} rounds.", - max_rounds - ); + panic!("Disaster recovery did not succeed within {max_rounds} rounds."); } fn await_disaster_recovery_failure(env: &PocketIc, station_id: Principal, upgrader_id: Principal) { @@ -73,10 +70,7 @@ fn await_disaster_recovery_failure(env: &PocketIc, station_id: Principal, upgrad return; } } - panic!( - "Disaster recovery did not fail within {} rounds.", - max_rounds - ); + panic!("Disaster recovery did not fail within {max_rounds} rounds."); } #[test] @@ -422,7 +416,7 @@ fn test_disaster_recovery_flow_recreates_same_accounts() { let mut initial_accounts = BTreeMap::new(); for account_nr in 0..3 { let create_account_args = AddAccountOperationInput { - name: format!("account-{}", account_nr), + name: format!("account-{account_nr}"), assets: vec![icp_asset.id.clone()], read_permission: AllowDTO { auth_scope: station_api::AuthScopeDTO::Restricted, @@ -1052,7 +1046,7 @@ fn test_disaster_recovery_committee_change_with_open_requests() { let users: Vec<_> = (0..5) .map(|i: u64| AdminUser { id: Uuid::from_u128(i.into()).hyphenated().to_string(), - name: format!("user_{}", i), + name: format!("user_{i}"), identities: vec![Principal::from_slice(&i.to_le_bytes())], }) .collect(); diff --git a/tests/integration/src/external_canister_tests.rs b/tests/integration/src/external_canister_tests.rs index ef124e6c5..aff3dc065 100644 --- a/tests/integration/src/external_canister_tests.rs +++ b/tests/integration/src/external_canister_tests.rs @@ -545,8 +545,7 @@ fn create_external_canister_and_check_status() { ) .unwrap_err(); assert!(err.reject_message.contains(&format!( - "Unauthorized access to resources: ExternalCanister(Read(Canister({})))", - canister_id + "Unauthorized access to resources: ExternalCanister(Read(Canister({canister_id})))" ))); } @@ -1182,10 +1181,7 @@ fn create_external_canister_with_too_many_cycles() { RequestStatusDTO::Failed { reason } => { assert_eq!(reason.unwrap(), format!("Request execution failed due to `failed to add external canister: FAILED: The external canister operation failed due to Canister {} has insufficient cycles balance to transfer {} cycles.`.", canister_ids.station, 2 * station_cycles)); } - _ => panic!( - "Unexpected request status: {:?}", - rich_canister_request_status - ), + _ => panic!("Unexpected request status: {rich_canister_request_status:?}"), }; // the station should still be healthy let health_status = @@ -1425,10 +1421,9 @@ fn snapshot_external_canister_test() { .unwrap(); match failed_request_status { RequestStatusDTO::Failed { reason } => assert!(reason.unwrap().contains(&format!( - "Canister {} has reached the maximum number of snapshots allowed: {}.", - external_canister_id, MAX_CANISTER_SNAPSHOTS + "Canister {external_canister_id} has reached the maximum number of snapshots allowed: {MAX_CANISTER_SNAPSHOTS}." ))), - _ => panic!("Unexpected request status: {:?}", failed_request_status), + _ => panic!("Unexpected request status: {failed_request_status:?}"), }; // restore the canister from the snapshot @@ -1672,7 +1667,7 @@ fn snapshot_unstoppable_external_canister_test() { RequestStatusDTO::Failed { reason } => { assert!(reason.unwrap().contains("Stop canister request timed out")) } - _ => panic!("Unexpected request status: {:?}", failed_request_status), + _ => panic!("Unexpected request status: {failed_request_status:?}"), }; // restart the canister diff --git a/tests/integration/src/http.rs b/tests/integration/src/http.rs index ed69d1be2..d13f15841 100644 --- a/tests/integration/src/http.rs +++ b/tests/integration/src/http.rs @@ -53,10 +53,7 @@ fn test_http_request_deconding_quota() { fn fetch_asset(canister_id: Principal, port: u16, path: &str, expected: &str) { let client = reqwest::blocking::Client::new(); - let url = format!( - "http://localhost:{}{}?canisterId={}", - port, path, canister_id - ); + let url = format!("http://localhost:{port}{path}?canisterId={canister_id}"); let res = client.get(url).send().unwrap(); let page = String::from_utf8(res.bytes().unwrap().to_vec()).unwrap(); assert!(page.contains(expected)); diff --git a/tests/integration/src/notification.rs b/tests/integration/src/notification.rs index 857a4336f..760b85a97 100644 --- a/tests/integration/src/notification.rs +++ b/tests/integration/src/notification.rs @@ -38,7 +38,7 @@ fn notification_authorization() { .unwrap(); match request_status { RequestStatusDTO::Failed { .. } => (), - _ => panic!("Unexpected request status: {:?}", request_status), + _ => panic!("Unexpected request status: {request_status:?}"), }; // admin user can list and update notifications diff --git a/tests/integration/src/station_migration_tests.rs b/tests/integration/src/station_migration_tests.rs index be409d477..9215a4b2c 100644 --- a/tests/integration/src/station_migration_tests.rs +++ b/tests/integration/src/station_migration_tests.rs @@ -143,7 +143,7 @@ fn test_canister_migration_path_with_previous_stable_memory_version(stable_memor } = setup_new_env(); let station_wasm = get_canister_wasm("station").to_vec(); - let stable_memory_file = format!("station-memory-v{}.bin", stable_memory_version); + let stable_memory_file = format!("station-memory-v{stable_memory_version}.bin"); let stable_memory = read_file(&stable_memory_file).expect("Unexpected missing older stable memory"); diff --git a/tests/integration/src/station_test_data/account.rs b/tests/integration/src/station_test_data/account.rs index ad06b8aa5..e88458f47 100644 --- a/tests/integration/src/station_test_data/account.rs +++ b/tests/integration/src/station_test_data/account.rs @@ -18,7 +18,7 @@ pub fn add_account( requester, station_canister_id, station_api::RequestOperationInput::AddAccount(station_api::AddAccountOperationInput { - name: format!("account-{}", next_id), + name: format!("account-{next_id}"), assets: vec![icp_asset.id], metadata: Vec::new(), configs_permission: station_api::AllowDTO { diff --git a/tests/integration/src/station_test_data/address_book.rs b/tests/integration/src/station_test_data/address_book.rs index c19d41307..7ffb278ad 100644 --- a/tests/integration/src/station_test_data/address_book.rs +++ b/tests/integration/src/station_test_data/address_book.rs @@ -19,7 +19,7 @@ pub fn add_address_book_entry( blockchain: "icp".to_string(), address_format: "icp_account_identifier".to_string(), labels: vec!["icp_native".to_string()], - address_owner: format!("user-{}", next_id), + address_owner: format!("user-{next_id}"), metadata: Vec::new(), address: format!("{}{}", "0x", sha256_hex(&next_id.to_le_bytes())), }, diff --git a/tests/integration/src/station_test_data/asset.rs b/tests/integration/src/station_test_data/asset.rs index 8b885aa67..89a57d756 100644 --- a/tests/integration/src/station_test_data/asset.rs +++ b/tests/integration/src/station_test_data/asset.rs @@ -39,11 +39,11 @@ pub fn add_asset( station_canister_id, requester, station_api::AddAssetOperationInput { - name: format!("asset-{}", next_id), + name: format!("asset-{next_id}"), blockchain: "icp".to_string(), standards: vec!["icp_native".to_string()], metadata: Vec::new(), - symbol: format!("SYM{}", next_id), + symbol: format!("SYM{next_id}"), decimals: 8, }, ) diff --git a/tests/integration/src/station_test_data/named_rule.rs b/tests/integration/src/station_test_data/named_rule.rs index 3d864c0b3..413db1272 100644 --- a/tests/integration/src/station_test_data/named_rule.rs +++ b/tests/integration/src/station_test_data/named_rule.rs @@ -45,8 +45,8 @@ pub fn add_named_rule( station_canister_id, requester, station_api::AddNamedRuleOperationInput { - name: format!("rule-{}", next_id), - description: Some(format!("Description for rule-{}", next_id)), + name: format!("rule-{next_id}"), + description: Some(format!("Description for rule-{next_id}")), rule: RequestPolicyRuleDTO::AutoApproved, }, ) diff --git a/tests/integration/src/station_test_data/user.rs b/tests/integration/src/station_test_data/user.rs index fb5a9052a..3bc4a6ed0 100644 --- a/tests/integration/src/station_test_data/user.rs +++ b/tests/integration/src/station_test_data/user.rs @@ -12,7 +12,7 @@ pub fn add_user( group_ids: Vec, ) -> station_api::UserDTO { let next_id = next_unique_id(); - let user_name = format!("user-{}", next_id); + let user_name = format!("user-{next_id}"); let next_id = next_id.to_be_bytes(); let identity = Principal::from_slice(next_id.as_ref()); let add_user = diff --git a/tests/integration/src/system_upgrade_tests.rs b/tests/integration/src/system_upgrade_tests.rs index b2ae3aeca..c84ceefd5 100644 --- a/tests/integration/src/system_upgrade_tests.rs +++ b/tests/integration/src/system_upgrade_tests.rs @@ -117,7 +117,7 @@ fn do_failed_system_upgrade( // check that the station upgrade request is failed match request_status { RequestStatusDTO::Failed { reason } => assert!(reason.unwrap().contains(expected_reason)), - _ => panic!("Unexpected request status: {:?}", request_status), + _ => panic!("Unexpected request status: {request_status:?}"), }; // check the station status after the failed upgrade @@ -513,7 +513,7 @@ fn failed_system_restore() { RequestStatusDTO::Failed { reason } => { assert!(reason.unwrap().contains("IC0408: Payload deserialization error: InvalidLength(\"Invalid snapshot ID length: provided 1, minumum length expected 37.\"")); } - _ => panic!("Unexpected request status: {:?}", status), + _ => panic!("Unexpected request status: {status:?}"), }; } } @@ -681,7 +681,7 @@ fn backup_snapshot() { RequestStatusDTO::Failed { reason } => { assert!(reason.unwrap().contains("Canister's Wasm module is not valid: Failed to decode wasm module: unsupported canister module format.")); } - _ => panic!("Unexpected request status: {:?}", status), + _ => panic!("Unexpected request status: {status:?}"), }; // a new backup snapshot should have been taken, replacing the previous backup snapshot diff --git a/tests/integration/src/upgrader_test_data.rs b/tests/integration/src/upgrader_test_data.rs index 3e7d6fdfc..3a8be97b5 100644 --- a/tests/integration/src/upgrader_test_data.rs +++ b/tests/integration/src/upgrader_test_data.rs @@ -293,7 +293,7 @@ impl<'a> UpgraderDataGenerator<'a> { Some(RecoveryResult::Failure(err)) => { assert!(err.reason.contains("Canister's Wasm module is not valid")) } - _ => panic!("Unexpected recovery result: {:?}", result), + _ => panic!("Unexpected recovery result: {result:?}"), }; let committee = diff --git a/tests/integration/src/utils.rs b/tests/integration/src/utils.rs index 29aa64614..3df610295 100644 --- a/tests/integration/src/utils.rs +++ b/tests/integration/src/utils.rs @@ -1117,10 +1117,7 @@ pub(crate) fn await_station_healthy(env: &PocketIc, station_id: Principal, user_ return; } } - panic!( - "Station did not become healthy within {} rounds.", - max_rounds - ); + panic!("Station did not become healthy within {max_rounds} rounds."); } pub(crate) fn add_external_canister_call_any_method_permission_and_approval( diff --git a/tools/dfx-orbit/src/canister/call.rs b/tools/dfx-orbit/src/canister/call.rs index c191a3874..94348f802 100644 --- a/tools/dfx-orbit/src/canister/call.rs +++ b/tools/dfx-orbit/src/canister/call.rs @@ -117,18 +117,18 @@ impl DfxOrbit { )? } if let Some(checksum) = &op.arg_checksum { - writeln!(output, "Argument checksum: {}", checksum)? + writeln!(output, "Argument checksum: {checksum}")? } if let Some(args) = &op.arg_rendering { - writeln!(output, "Argument: {}", args)? + writeln!(output, "Argument: {args}")? } if let Some(cycles) = &op.execution_method_cycles { - writeln!(output, "Execution method cycles: {}", cycles)? + writeln!(output, "Execution method cycles: {cycles}")? } if let Some(reply) = &op.execution_method_reply { match candid_parser::IDLArgs::from_bytes(reply) { // TODO: Check if we can get the type information from somewhere to annotate this with types - Ok(response) => writeln!(output, "Execution response: {}", response), + Ok(response) => writeln!(output, "Execution response: {response}"), Err(_) => writeln!(output, "FAILED TO PARSE EXECUTION RESPONSE"), }?; } diff --git a/tools/dfx-orbit/src/canister/install.rs b/tools/dfx-orbit/src/canister/install.rs index fb85adf6c..17c709c14 100644 --- a/tools/dfx-orbit/src/canister/install.rs +++ b/tools/dfx-orbit/src/canister/install.rs @@ -211,11 +211,11 @@ impl DfxOrbit { CanisterInstallMode::Reinstall => "Reinstall", CanisterInstallMode::Upgrade => "Upgrade", }; - writeln!(output, "Mode: {}", mode)?; + writeln!(output, "Mode: {mode}")?; writeln!(output, "Module checksum: {}", &op.module_checksum)?; if let Some(arg_checksum) = &op.arg_checksum { - writeln!(output, "Argument checksum: {}", arg_checksum)?; + writeln!(output, "Argument checksum: {arg_checksum}")?; } Ok(()) } diff --git a/tools/dfx-orbit/src/canister/util.rs b/tools/dfx-orbit/src/canister/util.rs index b2b086a95..a9bafff36 100644 --- a/tools/dfx-orbit/src/canister/util.rs +++ b/tools/dfx-orbit/src/canister/util.rs @@ -7,9 +7,9 @@ impl DfxOrbit { pub(super) fn try_reverse_lookup(&self, canister_id: &Principal) -> String { match self.canister_name(canister_id).ok() { Some(canister_name) => { - format!("{} ({})", canister_name, canister_id) + format!("{canister_name} ({canister_id})") } - None => format!("{}", canister_id), + None => format!("{canister_id}"), } } } diff --git a/tools/dfx-orbit/src/dfx.rs b/tools/dfx-orbit/src/dfx.rs index f412eb57e..10a009697 100644 --- a/tools/dfx-orbit/src/dfx.rs +++ b/tools/dfx-orbit/src/dfx.rs @@ -49,7 +49,7 @@ impl OrbitExtensionAgent { /// Gets the basename of the extension config file. fn config_file_name(&self) -> String { - format!("{}.json", ORBIT_EXTENSION_NAME) + format!("{ORBIT_EXTENSION_NAME}.json") } /// Gets the extension config file for this extension. If the file does not exist, it will be created. @@ -66,8 +66,7 @@ impl OrbitExtensionAgent { .open_with(filename, open_options) .with_context(|| { format!( - "Could not create extension config file for extension: {}", - ORBIT_EXTENSION_NAME + "Could not create extension config file for extension: {ORBIT_EXTENSION_NAME}" ) }) } @@ -79,17 +78,13 @@ impl OrbitExtensionAgent { .create_dir_all(ORBIT_EXTENSION_NAME) .with_context(|| { format!( - "Could not create extension directory for extension: {}", - ORBIT_EXTENSION_NAME + "Could not create extension directory for extension: {ORBIT_EXTENSION_NAME}" ) })?; extensions_dir .open_dir(ORBIT_EXTENSION_NAME) .with_context(|| { - format!( - "Could not open extension directory for extension: {}", - ORBIT_EXTENSION_NAME - ) + format!("Could not open extension directory for extension: {ORBIT_EXTENSION_NAME}") }) } diff --git a/tools/dfx-orbit/src/lib.rs b/tools/dfx-orbit/src/lib.rs index 08df89720..14a7841ae 100644 --- a/tools/dfx-orbit/src/lib.rs +++ b/tools/dfx-orbit/src/lib.rs @@ -75,10 +75,7 @@ impl DfxOrbit { let canister_id = Principal::from_text(canister_name).or_else(|_| { canister_id_store.get(canister_name).with_context(|| { - format!( - "Failed to look up principal id for canister named \"{}\"", - canister_name - ) + format!("Failed to look up principal id for canister named \"{canister_name}\"") }) })?; diff --git a/tools/dfx-orbit/src/local_config.rs b/tools/dfx-orbit/src/local_config.rs index 213be5bf4..8c3988c90 100644 --- a/tools/dfx-orbit/src/local_config.rs +++ b/tools/dfx-orbit/src/local_config.rs @@ -91,7 +91,7 @@ impl OrbitExtensionAgent { .filter(|station_name| self.station(station_name).is_ok()) // Add a little tick next to the station name if it is the default station .map(|name| match &default_station { - Some(default_name) if default_name == &name => format!("{} (*)", name), + Some(default_name) if default_name == &name => format!("{name} (*)"), _ => name, }) .collect(); @@ -155,7 +155,7 @@ impl OrbitExtensionAgent { let dir = self.stations_dir()?; let path = Self::station_file_name(name); dir.remove_file(path) - .with_context(|| format!("Failed to remove dfx config file for station {}", name))?; + .with_context(|| format!("Failed to remove dfx config file for station {name}"))?; if self.default_station_name()? == Some(name.to_string()) { self.set_default_station(None)?; @@ -252,6 +252,6 @@ impl OrbitExtensionAgent { /// The name of the file in which the config for a given station is stored. fn station_file_name(name: &str) -> String { - format!("{}.json", name) + format!("{name}.json") } } diff --git a/tools/dfx-orbit/src/main.rs b/tools/dfx-orbit/src/main.rs index aa4c99a27..a89a004e9 100644 --- a/tools/dfx-orbit/src/main.rs +++ b/tools/dfx-orbit/src/main.rs @@ -14,7 +14,7 @@ fn main() { .expect("Unable to create a runtime"); runtime.block_on(async { if let Err(err) = args.execute().await { - println!("Failed to execute command: {}", err); + println!("Failed to execute command: {err}"); std::process::exit(1); } }); diff --git a/tools/dfx-orbit/src/me.rs b/tools/dfx-orbit/src/me.rs index 4dfdf6f99..722497be0 100644 --- a/tools/dfx-orbit/src/me.rs +++ b/tools/dfx-orbit/src/me.rs @@ -29,7 +29,7 @@ impl DfxOrbit { .me .identities .iter() - .map(|p| format!("\n\t{}", p)) + .map(|p| format!("\n\t{p}")) .join("") )?; writeln!( diff --git a/tools/dfx-orbit/src/review/display.rs b/tools/dfx-orbit/src/review/display.rs index bd5029bdf..85d187c8a 100644 --- a/tools/dfx-orbit/src/review/display.rs +++ b/tools/dfx-orbit/src/review/display.rs @@ -31,7 +31,7 @@ impl DfxOrbit { )?; writeln!(output, "Title: {}", base_info.title)?; if let Some(ref summary) = base_info.summary { - writeln!(output, "Summary: {}", summary)? + writeln!(output, "Summary: {summary}")? } writeln!(output, "Requested by: {}", add_info.requester_name)?; @@ -44,7 +44,7 @@ impl DfxOrbit { display_request_status(&base_info.status) )?; if let Some(additional_status) = display_additional_stats_info(&base_info.status) { - writeln!(output, "{}", additional_status)?; + writeln!(output, "{additional_status}")?; } match base_info.operation { @@ -207,9 +207,9 @@ fn display_request_approvals( let name = usernames .get(&user.approver_id) .unwrap_or(&user.approver_id); - write!(writer, "\n\t{}", name)?; + write!(writer, "\n\t{name}")?; if let Some(reason) = &user.status_reason { - write!(writer, " (Reason: \"{}\")", reason)?; + write!(writer, " (Reason: \"{reason}\")")?; } } writeln!(writer)?; @@ -271,10 +271,10 @@ pub(super) fn display_request_status(status: &RequestStatusDTO) -> &'static str fn display_additional_stats_info(status: &RequestStatusDTO) -> Option { match status { RequestStatusDTO::Cancelled { reason } => { - reason.clone().map(|reason| format!("Reason: {}", reason)) + reason.clone().map(|reason| format!("Reason: {reason}")) } RequestStatusDTO::Failed { reason } => { - reason.clone().map(|reason| format!("Reason: {}", reason)) + reason.clone().map(|reason| format!("Reason: {reason}")) } _ => None, } diff --git a/tools/dfx-orbit/src/station.rs b/tools/dfx-orbit/src/station.rs index b89cf4470..28d7ed251 100644 --- a/tools/dfx-orbit/src/station.rs +++ b/tools/dfx-orbit/src/station.rs @@ -159,7 +159,7 @@ impl StationArgs { .with_context(|| "Failed to serialize station")?; println!("{json}"); } else { - println!("{}", station); + println!("{station}"); } } StationArgs::Remove(remove_args) => {