Skip to content

Commit 5efcfb0

Browse files
committed
Fix upstream clippy warnings + update CLI integration tests
Clippy auto-fixes (upstream production-grade commit): - gp-storage/hnsw.rs: 7 collapsible-if + 1 returning-let-binding - gp-mcp/server.rs: 1 collapsible-if - gp-palace/palace.rs: 3 map_or simplifications + iterate-on-keys CLI integration tests rewritten for new output format: - 26 tests matching production-grade CLI output - Adapted for auto-create behavior, new output formatting 720 tests, zero failures, zero clippy warnings.
1 parent c89c1f4 commit 5efcfb0

5 files changed

Lines changed: 450 additions & 763 deletions

File tree

rust/gp-cli/src/main.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,11 @@ fn load_config(config_file: &str) -> GraphPalaceConfig {
416416
/// Load config from the palace's saved config.json, falling back to defaults.
417417
fn load_palace_config(db_path: &str, config_file: &str) -> GraphPalaceConfig {
418418
let cpath = config_path(db_path);
419-
if Path::new(&cpath).exists() {
420-
if let Ok(json) = std::fs::read_to_string(&cpath) {
421-
if let Ok(config) = serde_json::from_str::<GraphPalaceConfig>(&json) {
419+
if Path::new(&cpath).exists()
420+
&& let Ok(json) = std::fs::read_to_string(&cpath)
421+
&& let Ok(config) = serde_json::from_str::<GraphPalaceConfig>(&json) {
422422
return config;
423423
}
424-
}
425-
}
426424
load_config(config_file)
427425
}
428426

@@ -1184,7 +1182,7 @@ fn main() -> Result<()> {
11841182
if wings.is_empty() {
11851183
println!("No wings found. Use 'graphpalace wing add' to create one.");
11861184
} else {
1187-
println!("{:<36} {:<20} {:<10} {}", "ID", "NAME", "TYPE", "DESCRIPTION");
1185+
println!("{:<36} {:<20} {:<10} DESCRIPTION", "ID", "NAME", "TYPE");
11881186
println!("{}", "-".repeat(80));
11891187
for w in &wings {
11901188
println!("{:<36} {:<20} {:<10} {}",
@@ -1391,8 +1389,8 @@ fn main() -> Result<()> {
13911389
}
13921390

13931391
// Simple bearer token auth: first non-empty line can be "AUTH <token>"
1394-
if !authenticated {
1395-
if let Some(ref expected) = token {
1392+
if !authenticated
1393+
&& let Some(ref expected) = token {
13961394
// Check for auth in the JSON-RPC params
13971395
if let Ok(req) = serde_json::from_str::<Value>(&line) {
13981396
let provided = req.get("params")
@@ -1414,7 +1412,6 @@ fn main() -> Result<()> {
14141412
}
14151413
}
14161414
}
1417-
}
14181415

14191416
let response = server.handle_json(&line);
14201417
writeln!(stdout, "{response}")?;

0 commit comments

Comments
 (0)