Skip to content

Commit 56af8cc

Browse files
Alex HolmbergAlex Holmberg
authored andcommitted
feat: fixed clippy issues
1 parent ab24ecf commit 56af8cc

12 files changed

Lines changed: 26 additions & 40 deletions

File tree

src/agent/session/ui.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,7 @@ pub fn print_banner(session: &ChatSession) {
206206
// Show platform context (selected project/organization)
207207
if session.platform_session.is_project_selected() {
208208
println!(
209-
" {} {}: {}/{}",
210-
"📦",
209+
" 📦 {}: {}/{}",
211210
"Project".white(),
212211
session
213212
.platform_session
@@ -223,12 +222,7 @@ pub fn print_banner(session: &ChatSession) {
223222
.cyan()
224223
);
225224
} else {
226-
println!(
227-
" {} {} {}",
228-
"📦",
229-
"Project:".white(),
230-
"(none selected)".dimmed()
231-
);
225+
println!(" 📦 {} {}", "Project:".white(), "(none selected)".dimmed());
232226
println!(" {} {}", "→".cyan(), "sync-ctl org list".dimmed());
233227
}
234228

src/agent/tools/platform/deploy_service.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ User: "deploy this service"
379379
.find(|c| c.service_name.eq_ignore_ascii_case(&service_name));
380380

381381
// 5. Get environment info for display
382-
let environments = match client.list_environments(&project_id).await {
383-
Ok(envs) => envs,
384-
Err(_) => Vec::new(),
385-
};
382+
let environments: Vec<crate::platform::api::types::Environment> = client
383+
.list_environments(&project_id)
384+
.await
385+
.unwrap_or_default();
386386

387387
// Resolve environment name for display
388388
let (resolved_env_id, resolved_env_name, is_production) =

src/agent/tools/platform/list_hetzner_availability.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,17 @@ This provides current data directly from Hetzner API - never use hardcoded/stati
210210
// Group server types by category for easier reading
211211
let shared_cpu: Vec<&serde_json::Value> = server_types_json
212212
.iter()
213-
.filter(|s| s["id"].as_str().map_or(false, |id| id.starts_with("cx")))
213+
.filter(|s| s["id"].as_str().is_some_and(|id| id.starts_with("cx")))
214214
.collect();
215215

216216
let dedicated_cpu: Vec<&serde_json::Value> = server_types_json
217217
.iter()
218-
.filter(|s| s["id"].as_str().map_or(false, |id| id.starts_with("ccx")))
218+
.filter(|s| s["id"].as_str().is_some_and(|id| id.starts_with("ccx")))
219219
.collect();
220220

221221
let performance: Vec<&serde_json::Value> = server_types_json
222222
.iter()
223-
.filter(|s| s["id"].as_str().map_or(false, |id| id.starts_with("cpx")))
223+
.filter(|s| s["id"].as_str().is_some_and(|id| id.starts_with("cpx")))
224224
.collect();
225225

226226
let response = json!({

src/analyzer/context/health_detector.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::analyzer::{
99
DetectedTechnology, HealthEndpoint, HealthEndpointSource, TechnologyCategory,
1010
};
1111
use crate::common::file_utils::{is_readable_file, read_file_safe};
12-
use crate::error::Result;
1312
use regex::Regex;
1413
use std::path::Path;
1514

src/analyzer/display/matrix_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::analyzer::display::{
44
BoxDrawer, format_list_smart, format_ports_smart, get_color_adapter, get_terminal_width,
5-
helpers::{add_confidence_bar_to_drawer, format_project_category, get_main_technologies},
5+
helpers::{add_confidence_bar_to_drawer, format_project_category},
66
smart_truncate, visual_width,
77
};
88
use crate::analyzer::{ArchitecturePattern, MonorepoAnalysis};

src/analyzer/docker_analyzer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ fn infer_default_port(base_image: &Option<String>) -> Option<u16> {
13591359
// Extract image name without registry/tag
13601360
let image_name = image_lower
13611361
.split('/')
1362-
.last()
1362+
.next_back()
13631363
.unwrap_or(&image_lower)
13641364
.split(':')
13651365
.next()

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub async fn run_command(
337337
);
338338
}
339339
OutputFormat::Table => {
340-
println!("\n{:<40} {:<30} {}", "ID", "NAME", "DESCRIPTION");
340+
println!("\n{:<40} {:<30} DESCRIPTION", "ID", "NAME");
341341
println!("{}", "-".repeat(90));
342342
for project in projects {
343343
let desc = if project.description.is_empty() {
@@ -542,7 +542,7 @@ pub async fn run_command(
542542
);
543543
}
544544
OutputFormat::Table => {
545-
println!("\n{:<40} {:<30} {}", "ID", "NAME", "SLUG");
545+
println!("\n{:<40} {:<30} SLUG", "ID", "NAME");
546546
println!("{}", "-".repeat(90));
547547
for org in orgs {
548548
let slug =

src/server/processor.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ use rig::completion::{CompletionModel, CompletionResponse, Message as RigPromptM
6565
use serde::{Deserialize, Serialize};
6666
use std::sync::Arc;
6767
use syncable_ag_ui_core::ToolCallId;
68-
use syncable_ag_ui_core::state::StateManager;
6968
use tokio::sync::Mutex;
7069

7170
/// Step status for generative UI progress display.

src/wizard/cloud_provider_data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ pub async fn get_recommended_server_type(
697697
})
698698
.filter(|st| {
699699
// If preferred location is set, only include types available there
700-
preferred_location.map_or(true, |loc| st.available_in.contains(&loc.to_string()))
700+
preferred_location.is_none_or(|loc| st.available_in.contains(&loc.to_string()))
701701
})
702702
.min_by(|a, b| a.price_monthly.partial_cmp(&b.price_monthly).unwrap())
703703
}
@@ -719,8 +719,8 @@ pub async fn find_best_region(
719719
// Sort by availability count, preferring specified zone
720720
let mut sorted_regions = regions;
721721
sorted_regions.sort_by(|a, b| {
722-
let a_zone_match = preferred_zone.map_or(false, |z| a.network_zone == z);
723-
let b_zone_match = preferred_zone.map_or(false, |z| b.network_zone == z);
722+
let a_zone_match = preferred_zone.is_some_and(|z| a.network_zone == z);
723+
let b_zone_match = preferred_zone.is_some_and(|z| b.network_zone == z);
724724

725725
match (a_zone_match, b_zone_match) {
726726
(true, false) => std::cmp::Ordering::Less,

src/wizard/config_form.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ fn collect_env_vars_manually() -> Vec<DeploymentSecretInput> {
441441
is_secret,
442442
});
443443

444-
let add_another = match Confirm::new("Add another?").with_default(false).prompt() {
445-
Ok(v) => v,
446-
Err(_) => false,
447-
};
444+
let add_another = Confirm::new("Add another?")
445+
.with_default(false)
446+
.prompt()
447+
.unwrap_or_default();
448448

449449
if !add_another {
450450
break;
@@ -567,13 +567,10 @@ fn collect_env_vars_from_file(
567567
);
568568
}
569569

570-
let confirm = match Confirm::new("Use these variables?")
570+
let confirm = Confirm::new("Use these variables?")
571571
.with_default(true)
572572
.prompt()
573-
{
574-
Ok(v) => v,
575-
Err(_) => false,
576-
};
573+
.unwrap_or_default();
577574

578575
if confirm { secrets } else { Vec::new() }
579576
}

0 commit comments

Comments
 (0)