diff --git a/src-tauri/gen/schemas/linux-schema.json b/src-tauri/gen/schemas/linux-schema.json index 62ae3c87..7c2d7c72 100644 --- a/src-tauri/gen/schemas/linux-schema.json +++ b/src-tauri/gen/schemas/linux-schema.json @@ -2324,24 +2324,6 @@ "Identifier": { "description": "Permission identifier", "oneOf": [ - { - "description": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`", - "type": "string", - "const": "cli:default", - "markdownDescription": "Allows reading the CLI matches\n#### This default permission set includes:\n\n- `allow-cli-matches`" - }, - { - "description": "Enables the cli_matches command without any pre-configured scope.", - "type": "string", - "const": "cli:allow-cli-matches", - "markdownDescription": "Enables the cli_matches command without any pre-configured scope." - }, - { - "description": "Denies the cli_matches command without any pre-configured scope.", - "type": "string", - "const": "cli:deny-cli-matches", - "markdownDescription": "Denies the cli_matches command without any pre-configured scope." - }, { "description": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`", "type": "string", @@ -6373,60 +6355,6 @@ "type": "string", "const": "stronghold:deny-save-store-record", "markdownDescription": "Denies the save_store_record command without any pre-configured scope." - }, - { - "description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`", - "type": "string", - "const": "updater:default", - "markdownDescription": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`" - }, - { - "description": "Enables the check command without any pre-configured scope.", - "type": "string", - "const": "updater:allow-check", - "markdownDescription": "Enables the check command without any pre-configured scope." - }, - { - "description": "Enables the download command without any pre-configured scope.", - "type": "string", - "const": "updater:allow-download", - "markdownDescription": "Enables the download command without any pre-configured scope." - }, - { - "description": "Enables the download_and_install command without any pre-configured scope.", - "type": "string", - "const": "updater:allow-download-and-install", - "markdownDescription": "Enables the download_and_install command without any pre-configured scope." - }, - { - "description": "Enables the install command without any pre-configured scope.", - "type": "string", - "const": "updater:allow-install", - "markdownDescription": "Enables the install command without any pre-configured scope." - }, - { - "description": "Denies the check command without any pre-configured scope.", - "type": "string", - "const": "updater:deny-check", - "markdownDescription": "Denies the check command without any pre-configured scope." - }, - { - "description": "Denies the download command without any pre-configured scope.", - "type": "string", - "const": "updater:deny-download", - "markdownDescription": "Denies the download command without any pre-configured scope." - }, - { - "description": "Denies the download_and_install command without any pre-configured scope.", - "type": "string", - "const": "updater:deny-download-and-install", - "markdownDescription": "Denies the download_and_install command without any pre-configured scope." - }, - { - "description": "Denies the install command without any pre-configured scope.", - "type": "string", - "const": "updater:deny-install", - "markdownDescription": "Denies the install command without any pre-configured scope." } ] }, diff --git a/src-tauri/src/ai/mistral.rs b/src-tauri/src/ai/mistral.rs index 4f62c915..3fc2192d 100644 --- a/src-tauri/src/ai/mistral.rs +++ b/src-tauri/src/ai/mistral.rs @@ -47,7 +47,10 @@ impl Provider for MistralProvider { let resp = client .post(&url) - .header("Authorization", format!("Bearer {}", config.api_key)) + .header( + "Authorization", + format!("Bearer {api_key}", api_key = config.api_key), + ) .header("Content-Type", "application/json") .json(&body) .send() diff --git a/src-tauri/src/ai/openai.rs b/src-tauri/src/ai/openai.rs index cd2270d4..5e47f5ff 100644 --- a/src-tauri/src/ai/openai.rs +++ b/src-tauri/src/ai/openai.rs @@ -54,7 +54,10 @@ impl OpenAiProvider { .custom_endpoint_path .as_deref() .unwrap_or("/chat/completions"); - let url = format!("{}{}", config.api_url.trim_end_matches('/'), endpoint_path); + let url = format!( + "{base}{endpoint_path}", + base = config.api_url.trim_end_matches('/') + ); let mut body = serde_json::json!({ "model": config.model, @@ -75,7 +78,7 @@ impl OpenAiProvider { .as_deref() .unwrap_or("Authorization"); let auth_prefix = config.custom_auth_prefix.as_deref().unwrap_or("Bearer "); - let auth_value = format!("{}{}", auth_prefix, config.api_key); + let auth_value = format!("{auth_prefix}{api_key}", api_key = config.api_key); let resp = client .post(&url) @@ -122,7 +125,10 @@ impl OpenAiProvider { // Use custom endpoint path, default to empty (API URL already includes /api/v2/chat) let endpoint_path = config.custom_endpoint_path.as_deref().unwrap_or(""); - let url = format!("{}{}", config.api_url.trim_end_matches('/'), endpoint_path); + let url = format!( + "{base}{endpoint_path}", + base = config.api_url.trim_end_matches('/') + ); // Extract system message if present let system_message = messages @@ -177,7 +183,7 @@ impl OpenAiProvider { .as_deref() .unwrap_or("x-msi-genai-api-key"); let auth_prefix = config.custom_auth_prefix.as_deref().unwrap_or(""); - let auth_value = format!("{}{}", auth_prefix, config.api_key); + let auth_value = format!("{auth_prefix}{api_key}", api_key = config.api_key); let resp = client .post(&url) diff --git a/src-tauri/src/audit/log.rs b/src-tauri/src/audit/log.rs index 7db8d241..45fb516c 100644 --- a/src-tauri/src/audit/log.rs +++ b/src-tauri/src/audit/log.rs @@ -97,9 +97,9 @@ mod tests { for i in 0..5 { write_audit_event( &conn, - &format!("action_{}", i), + &format!("action_{i}"), "test", - &format!("id_{}", i), + &format!("id_{i}"), "{}", ) .unwrap(); diff --git a/src-tauri/src/commands/db.rs b/src-tauri/src/commands/db.rs index fbe5a77a..427a6c3f 100644 --- a/src-tauri/src/commands/db.rs +++ b/src-tauri/src/commands/db.rs @@ -295,19 +295,19 @@ pub async fn list_issues( let mut params: Vec> = vec![]; if let Some(ref status) = filter.status { - sql.push_str(&format!(" AND i.status = ?{}", params.len() + 1)); + sql.push_str(&format!(" AND i.status = ?{idx}", idx = params.len() + 1)); params.push(Box::new(status.clone())); } if let Some(ref severity) = filter.severity { - sql.push_str(&format!(" AND i.severity = ?{}", params.len() + 1)); + sql.push_str(&format!(" AND i.severity = ?{idx}", idx = params.len() + 1)); params.push(Box::new(severity.clone())); } if let Some(ref category) = filter.category { - sql.push_str(&format!(" AND i.category = ?{}", params.len() + 1)); + sql.push_str(&format!(" AND i.category = ?{idx}", idx = params.len() + 1)); params.push(Box::new(category.clone())); } if let Some(ref domain) = filter.domain { - sql.push_str(&format!(" AND i.category = ?{}", params.len() + 1)); + sql.push_str(&format!(" AND i.category = ?{idx}", idx = params.len() + 1)); params.push(Box::new(domain.clone())); } if let Some(ref search) = filter.search { diff --git a/src-tauri/src/commands/docs.rs b/src-tauri/src/commands/docs.rs index 11e6dc18..4cc0fe5a 100644 --- a/src-tauri/src/commands/docs.rs +++ b/src-tauri/src/commands/docs.rs @@ -34,7 +34,7 @@ pub async fn generate_rca( id: doc_id.clone(), issue_id: issue_id.clone(), doc_type: "rca".to_string(), - title: format!("RCA: {}", issue_detail.issue.title), + title: format!("RCA: {title}", title = issue_detail.issue.title), content_md: content_md.clone(), created_at: now.clone(), updated_at: now, @@ -93,7 +93,7 @@ pub async fn generate_postmortem( id: doc_id.clone(), issue_id: issue_id.clone(), doc_type: "postmortem".to_string(), - title: format!("Post-Mortem: {}", issue_detail.issue.title), + title: format!("Post-Mortem: {title}", title = issue_detail.issue.title), content_md: content_md.clone(), created_at: now.clone(), updated_at: now, diff --git a/src-tauri/src/commands/integrations.rs b/src-tauri/src/commands/integrations.rs index 1240c7d7..244ed952 100644 --- a/src-tauri/src/commands/integrations.rs +++ b/src-tauri/src/commands/integrations.rs @@ -94,7 +94,7 @@ pub async fn initiate_oauth( let (mut callback_rx, shutdown_tx) = crate::integrations::callback_server::start_callback_server(8765) .await - .map_err(|e| format!("Failed to start callback server: {}", e))?; + .map_err(|e| format!("Failed to start callback server: {e}"))?; // Store shutdown channel { @@ -166,7 +166,7 @@ pub async fn initiate_oauth( { let mut oauth_state = OAUTH_STATE .lock() - .map_err(|e| format!("Failed to lock OAuth state: {}", e))?; + .map_err(|e| format!("Failed to lock OAuth state: {e}"))?; oauth_state.insert( state_key.clone(), (service.clone(), pkce.code_verifier.clone()), @@ -193,7 +193,7 @@ pub async fn initiate_oauth( // ServiceNow uses basic auth, not OAuth2 return Err("ServiceNow uses basic authentication, not OAuth2".to_string()); } - _ => return Err(format!("Unknown service: {}", service)), + _ => return Err(format!("Unknown service: {service}")), }; let auth_url = crate::integrations::auth::build_auth_url( @@ -231,7 +231,7 @@ async fn handle_oauth_callback_internal( .unwrap_or_else(|_| "ado-client-id-placeholder".to_string()), "http://localhost:8765/callback", ), - _ => return Err(format!("Unknown service: {}", service)), + _ => return Err(format!("Unknown service: {service}")), }; // Exchange authorization code for access token @@ -265,7 +265,7 @@ async fn handle_oauth_callback_internal( let db = app_state .db .lock() - .map_err(|e| format!("Failed to lock database: {}", e))?; + .map_err(|e| format!("Failed to lock database: {e}"))?; db.execute( "INSERT OR REPLACE INTO credentials (id, service, token_hash, encrypted_token, created_at, expires_at) @@ -279,7 +279,7 @@ async fn handle_oauth_callback_internal( expires_at, ], ) - .map_err(|e| format!("Failed to store credentials: {}", e))?; + .map_err(|e| format!("Failed to store credentials: {e}"))?; // Log audit event let audit_details = serde_json::json!({ @@ -301,7 +301,7 @@ async fn handle_oauth_callback_internal( audit_details.to_string(), ], ) - .map_err(|e| format!("Failed to log audit event: {}", e))?; + .map_err(|e| format!("Failed to log audit event: {e}"))?; Ok(()) } @@ -319,7 +319,7 @@ pub async fn handle_oauth_callback( let verifier = { let mut oauth_state = OAUTH_STATE .lock() - .map_err(|e| format!("Failed to lock OAuth state: {}", e))?; + .map_err(|e| format!("Failed to lock OAuth state: {e}"))?; oauth_state .remove(&state_key) .map(|(_svc, ver)| ver) @@ -514,13 +514,13 @@ pub async fn authenticate_with_webview( app_handle: tauri::AppHandle, app_state: State<'_, AppState>, ) -> Result { - let webview_id = format!("{}-auth", service); + let webview_id = format!("{service}-auth"); // Check if window already exists if let Some(existing_label) = app_state .integration_webviews .lock() - .map_err(|e| format!("Failed to lock webviews: {}", e))? + .map_err(|e| format!("Failed to lock webviews: {e}"))? .get(&service) { if app_handle.get_webview_window(existing_label).is_some() { @@ -545,7 +545,7 @@ pub async fn authenticate_with_webview( app_state .integration_webviews .lock() - .map_err(|e| format!("Failed to lock webviews: {}", e))? + .map_err(|e| format!("Failed to lock webviews: {e}"))? .insert(service.clone(), webview_id.clone()); Ok(WebviewAuthResponse { @@ -582,8 +582,8 @@ pub async fn extract_cookies_from_webview( } // Encrypt and store cookies in database - let cookies_json = serde_json::to_string(&cookies) - .map_err(|e| format!("Failed to serialize cookies: {}", e))?; + let cookies_json = + serde_json::to_string(&cookies).map_err(|e| format!("Failed to serialize cookies: {e}"))?; let encrypted_cookies = crate::integrations::auth::encrypt_token(&cookies_json)?; let token_hash = { @@ -597,7 +597,7 @@ pub async fn extract_cookies_from_webview( let db = app_state .db .lock() - .map_err(|e| format!("Failed to lock database: {}", e))?; + .map_err(|e| format!("Failed to lock database: {e}"))?; db.execute( "INSERT OR REPLACE INTO credentials (id, service, token_hash, encrypted_token, created_at, expires_at) @@ -611,18 +611,18 @@ pub async fn extract_cookies_from_webview( None::, // Cookies don't have explicit expiry ], ) - .map_err(|e| format!("Failed to store cookies: {}", e))?; + .map_err(|e| format!("Failed to store cookies: {e}"))?; // Close the webview window if let Some(webview) = app_handle.get_webview_window(&webview_id) { webview .close() - .map_err(|e| format!("Failed to close webview: {}", e))?; + .map_err(|e| format!("Failed to close webview: {e}"))?; } Ok(ConnectionResult { success: true, - message: format!("{} authentication saved successfully", service), + message: format!("{service} authentication saved successfully"), }) } @@ -669,7 +669,12 @@ pub async fn save_manual_token( }; crate::integrations::servicenow::test_connection(&config).await } - _ => return Err(format!("Unknown service: {}", request.service)), + _ => { + return Err(format!( + "Unknown service: {service}", + service = request.service + )) + } }; // If test fails, don't save the token @@ -698,7 +703,7 @@ pub async fn save_manual_token( let db = app_state .db .lock() - .map_err(|e| format!("Failed to lock database: {}", e))?; + .map_err(|e| format!("Failed to lock database: {e}"))?; db.execute( "INSERT OR REPLACE INTO credentials (id, service, token_hash, encrypted_token, created_at, expires_at) @@ -712,7 +717,7 @@ pub async fn save_manual_token( None::, ], ) - .map_err(|e| format!("Failed to store token: {}", e))?; + .map_err(|e| format!("Failed to store token: {e}"))?; // Log audit event db.execute( @@ -732,11 +737,14 @@ pub async fn save_manual_token( .to_string(), ], ) - .map_err(|e| format!("Failed to log audit event: {}", e))?; + .map_err(|e| format!("Failed to log audit event: {e}"))?; Ok(ConnectionResult { success: true, - message: format!("{} token saved and validated successfully", request.service), + message: format!( + "{service} token saved and validated successfully", + service = request.service + ), }) } @@ -757,7 +765,7 @@ pub async fn get_fresh_cookies_from_webview( let webviews = app_state .integration_webviews .lock() - .map_err(|e| format!("Failed to lock webviews: {}", e))?; + .map_err(|e| format!("Failed to lock webviews: {e}"))?; match webviews.get(service) { Some(label) => label.clone(), @@ -773,7 +781,7 @@ pub async fn get_fresh_cookies_from_webview( app_state .integration_webviews .lock() - .map_err(|e| format!("Failed to lock webviews: {}", e))? + .map_err(|e| format!("Failed to lock webviews: {e}"))? .remove(service); return Ok(None); } @@ -814,7 +822,7 @@ pub async fn save_integration_config( let db = app_state .db .lock() - .map_err(|e| format!("Failed to lock database: {}", e))?; + .map_err(|e| format!("Failed to lock database: {e}"))?; db.execute( "INSERT OR REPLACE INTO integration_config @@ -829,7 +837,7 @@ pub async fn save_integration_config( config.space_key, ], ) - .map_err(|e| format!("Failed to save integration config: {}", e))?; + .map_err(|e| format!("Failed to save integration config: {e}"))?; Ok(()) } @@ -843,11 +851,11 @@ pub async fn get_integration_config( let db = app_state .db .lock() - .map_err(|e| format!("Failed to lock database: {}", e))?; + .map_err(|e| format!("Failed to lock database: {e}"))?; let mut stmt = db .prepare("SELECT service, base_url, username, project_name, space_key FROM integration_config WHERE service = ?1") - .map_err(|e| format!("Failed to prepare query: {}", e))?; + .map_err(|e| format!("Failed to prepare query: {e}"))?; let config = stmt .query_row([&service], |row| { @@ -860,7 +868,7 @@ pub async fn get_integration_config( }) }) .optional() - .map_err(|e| format!("Failed to query integration config: {}", e))?; + .map_err(|e| format!("Failed to query integration config: {e}"))?; Ok(config) } @@ -873,13 +881,13 @@ pub async fn get_all_integration_configs( let db = app_state .db .lock() - .map_err(|e| format!("Failed to lock database: {}", e))?; + .map_err(|e| format!("Failed to lock database: {e}"))?; let mut stmt = db .prepare( "SELECT service, base_url, username, project_name, space_key FROM integration_config", ) - .map_err(|e| format!("Failed to prepare query: {}", e))?; + .map_err(|e| format!("Failed to prepare query: {e}"))?; let configs = stmt .query_map([], |row| { @@ -891,9 +899,9 @@ pub async fn get_all_integration_configs( space_key: row.get(4)?, }) }) - .map_err(|e| format!("Failed to query integration configs: {}", e))? + .map_err(|e| format!("Failed to query integration configs: {e}"))? .collect::, _>>() - .map_err(|e| format!("Failed to collect integration configs: {}", e))?; + .map_err(|e| format!("Failed to collect integration configs: {e}"))?; Ok(configs) } diff --git a/src-tauri/src/commands/system.rs b/src-tauri/src/commands/system.rs index 7baf15a2..f8f98d94 100644 --- a/src-tauri/src/commands/system.rs +++ b/src-tauri/src/commands/system.rs @@ -98,20 +98,23 @@ pub async fn get_audit_log( let mut params: Vec> = vec![]; if let Some(ref action) = filter.action { - sql.push_str(&format!(" AND action = ?{}", params.len() + 1)); + sql.push_str(&format!(" AND action = ?{idx}", idx = params.len() + 1)); params.push(Box::new(action.clone())); } if let Some(ref entity_type) = filter.entity_type { - sql.push_str(&format!(" AND entity_type = ?{}", params.len() + 1)); + sql.push_str(&format!( + " AND entity_type = ?{idx}", + idx = params.len() + 1 + )); params.push(Box::new(entity_type.clone())); } if let Some(ref entity_id) = filter.entity_id { - sql.push_str(&format!(" AND entity_id = ?{}", params.len() + 1)); + sql.push_str(&format!(" AND entity_id = ?{idx}", idx = params.len() + 1)); params.push(Box::new(entity_id.clone())); } sql.push_str(" ORDER BY timestamp DESC"); - sql.push_str(&format!(" LIMIT ?{}", params.len() + 1)); + sql.push_str(&format!(" LIMIT ?{idx}", idx = params.len() + 1)); params.push(Box::new(limit)); let param_refs: Vec<&dyn rusqlite::types::ToSql> = params.iter().map(|p| p.as_ref()).collect(); diff --git a/src-tauri/src/integrations/auth.rs b/src-tauri/src/integrations/auth.rs index fc9d1dba..506e209a 100644 --- a/src-tauri/src/integrations/auth.rs +++ b/src-tauri/src/integrations/auth.rs @@ -88,7 +88,7 @@ pub async fn exchange_code( .form(¶ms) .send() .await - .map_err(|e| format!("Failed to send token exchange request: {}", e))?; + .map_err(|e| format!("Failed to send token exchange request: {e}"))?; if !resp.status().is_success() { return Err(format!( @@ -101,7 +101,7 @@ pub async fn exchange_code( let body: serde_json::Value = resp .json() .await - .map_err(|e| format!("Failed to parse token response: {}", e))?; + .map_err(|e| format!("Failed to parse token response: {e}"))?; let access_token = body["access_token"] .as_str() @@ -208,7 +208,7 @@ pub fn encrypt_token(token: &str) -> Result { // Encrypt let ciphertext = cipher .encrypt(nonce, token.as_bytes()) - .map_err(|e| format!("Encryption failed: {}", e))?; + .map_err(|e| format!("Encryption failed: {e}"))?; // Prepend nonce to ciphertext let mut result = nonce_bytes.to_vec(); @@ -232,7 +232,7 @@ pub fn decrypt_token(encrypted: &str) -> Result { use base64::Engine; let data = STANDARD .decode(encrypted) - .map_err(|e| format!("Base64 decode failed: {}", e))?; + .map_err(|e| format!("Base64 decode failed: {e}"))?; if data.len() < 12 { return Err("Invalid encrypted data: too short".to_string()); @@ -256,9 +256,9 @@ pub fn decrypt_token(encrypted: &str) -> Result { // Decrypt let plaintext = cipher .decrypt(nonce, ciphertext) - .map_err(|e| format!("Decryption failed: {}", e))?; + .map_err(|e| format!("Decryption failed: {e}"))?; - String::from_utf8(plaintext).map_err(|e| format!("Invalid UTF-8: {}", e)) + String::from_utf8(plaintext).map_err(|e| format!("Invalid UTF-8: {e}")) } #[cfg(test)] diff --git a/src-tauri/src/integrations/azuredevops.rs b/src-tauri/src/integrations/azuredevops.rs index a8651516..3d47e08b 100644 --- a/src-tauri/src/integrations/azuredevops.rs +++ b/src-tauri/src/integrations/azuredevops.rs @@ -32,7 +32,7 @@ pub async fn test_connection(config: &AzureDevOpsConfig) -> Result Result Result Result Result, String .query(&[("limit", "100")]) .send() .await - .map_err(|e| format!("Failed to list spaces: {}", e))?; + .map_err(|e| format!("Failed to list spaces: {e}"))?; if !resp.status().is_success() { return Err(format!( @@ -74,7 +77,7 @@ pub async fn list_spaces(config: &ConfluenceConfig) -> Result, String let body: serde_json::Value = resp .json() .await - .map_err(|e| format!("Failed to parse response: {}", e))?; + .map_err(|e| format!("Failed to parse response: {e}"))?; let spaces = body["results"] .as_array() @@ -105,7 +108,7 @@ pub async fn search_pages( let mut cql = format!("text ~ \"{}\"", query); if let Some(space) = space_key { - cql = format!("{} AND space = {}", cql, space); + cql = format!("{cql} AND space = {space}"); } let resp = client @@ -114,7 +117,7 @@ pub async fn search_pages( .query(&[("cql", &cql), ("limit", &"50".to_string())]) .send() .await - .map_err(|e| format!("Search failed: {}", e))?; + .map_err(|e| format!("Search failed: {e}"))?; if !resp.status().is_success() { return Err(format!( @@ -127,7 +130,7 @@ pub async fn search_pages( let body: serde_json::Value = resp .json() .await - .map_err(|e| format!("Failed to parse response: {}", e))?; + .map_err(|e| format!("Failed to parse response: {e}"))?; let pages = body["results"] .as_array() @@ -140,7 +143,7 @@ pub async fn search_pages( id: page_id.to_string(), title: p["title"].as_str()?.to_string(), space_key: p["space"]["key"].as_str()?.to_string(), - url: format!("{}/pages/viewpage.action?pageId={}", base_url, page_id), + url: format!("{base_url}/pages/viewpage.action?pageId={page_id}"), }) }) .collect(); @@ -182,7 +185,7 @@ pub async fn publish_page( .json(&body) .send() .await - .map_err(|e| format!("Failed to publish page: {}", e))?; + .map_err(|e| format!("Failed to publish page: {e}"))?; if !resp.status().is_success() { return Err(format!( @@ -195,7 +198,7 @@ pub async fn publish_page( let result: serde_json::Value = resp .json() .await - .map_err(|e| format!("Failed to parse response: {}", e))?; + .map_err(|e| format!("Failed to parse response: {e}"))?; let page_id = result["id"].as_str().unwrap_or(""); let page_url = format!( @@ -245,7 +248,7 @@ pub async fn update_page( .json(&body) .send() .await - .map_err(|e| format!("Failed to update page: {}", e))?; + .map_err(|e| format!("Failed to update page: {e}"))?; if !resp.status().is_success() { return Err(format!( @@ -258,7 +261,7 @@ pub async fn update_page( let result: serde_json::Value = resp .json() .await - .map_err(|e| format!("Failed to parse response: {}", e))?; + .map_err(|e| format!("Failed to parse response: {e}"))?; let updated_page_id = result["id"].as_str().unwrap_or(page_id); let page_url = format!( diff --git a/src-tauri/src/integrations/servicenow.rs b/src-tauri/src/integrations/servicenow.rs index b54d8254..8649242b 100644 --- a/src-tauri/src/integrations/servicenow.rs +++ b/src-tauri/src/integrations/servicenow.rs @@ -34,7 +34,7 @@ pub async fn test_connection(config: &ServiceNowConfig) -> Result Result format!("{}/login.do", base_url.trim_end_matches('/')), - _ => return Err(format!("Unknown service: {}", service)), + _ => return Err(format!("Unknown service: {service}")), }; tracing::info!( @@ -42,17 +42,13 @@ pub async fn authenticate_with_webview( ); // Create persistent browser window (stays open for browsing and fresh cookie extraction) - let webview_label = format!("{}-auth", service); + let webview_label = format!("{service}-auth"); let webview = WebviewWindowBuilder::new( &app_handle, &webview_label, - WebviewUrl::External( - login_url - .parse() - .map_err(|e| format!("Invalid URL: {}", e))?, - ), + WebviewUrl::External(login_url.parse().map_err(|e| format!("Invalid URL: {e}"))?), ) - .title(format!("{} Browser (TFTSR)", service)) + .title(format!("{service} Browser (TFTSR)")) .inner_size(1000.0, 800.0) .min_inner_size(800.0, 600.0) .resizable(true) @@ -60,7 +56,7 @@ pub async fn authenticate_with_webview( .focused(true) .visible(true) .build() - .map_err(|e| format!("Failed to create webview: {}", e))?; + .map_err(|e| format!("Failed to create webview: {e}"))?; // Focus the window webview @@ -147,7 +143,7 @@ pub async fn extract_cookies_via_ipc( match serde_json::from_str::(payload_str) { Ok(payload) => { if let Some(error_msg) = payload.get("error").and_then(|e| e.as_str()) { - let _ = tx.try_send(Err(format!("JavaScript error: {}", error_msg))); + let _ = tx.try_send(Err(format!("JavaScript error: {error_msg}"))); return; } @@ -159,7 +155,7 @@ pub async fn extract_cookies_via_ipc( } Err(e) => { tracing::error!("Failed to parse cookies: {}", e); - let _ = tx.try_send(Err(format!("Failed to parse cookies: {}", e))); + let _ = tx.try_send(Err(format!("Failed to parse cookies: {e}"))); } } } else { @@ -168,7 +164,7 @@ pub async fn extract_cookies_via_ipc( } Err(e) => { tracing::error!("Failed to parse event payload: {}", e); - let _ = tx.try_send(Err(format!("Failed to parse event payload: {}", e))); + let _ = tx.try_send(Err(format!("Failed to parse event payload: {e}"))); } } }); @@ -176,7 +172,7 @@ pub async fn extract_cookies_via_ipc( // Inject the script into the webview webview_window .eval(cookie_extraction_script) - .map_err(|e| format!("Failed to inject cookie extraction script: {}", e))?; + .map_err(|e| format!("Failed to inject cookie extraction script: {e}"))?; tracing::info!("Cookie extraction script injected, waiting for response..."); @@ -199,7 +195,7 @@ pub async fn extract_cookies_via_ipc( pub fn cookies_to_header(cookies: &[Cookie]) -> String { cookies .iter() - .map(|c| format!("{}={}", c.name, c.value)) + .map(|c| format!("{name}={value}", name = c.name, value = c.value)) .collect::>() .join("; ") }