diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 0b5992fa..9bfb089e 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -1128,10 +1128,10 @@ fn merge_provider_config(target: &mut ProviderConfigToml, source: &ProviderConfi pub fn load_project_config(workspace: &Path) -> Option { for dir in [CODEWHALE_APP_DIR, LEGACY_APP_DIR] { let path = workspace.join(dir).join(CONFIG_FILE_NAME); - if path.exists() { - if let Ok(raw) = fs::read_to_string(&path) { - return toml::from_str(&raw).ok(); - } + if path.exists() + && let Ok(raw) = fs::read_to_string(&path) + { + return toml::from_str(&raw).ok(); } } None diff --git a/crates/tui/src/commands/init.rs b/crates/tui/src/commands/init.rs index 6dd74353..7e302746 100644 --- a/crates/tui/src/commands/init.rs +++ b/crates/tui/src/commands/init.rs @@ -75,14 +75,13 @@ fn ensure_deepseek_gitignored(workspace: &Path) { // If the file is non-empty and doesn't end with a newline, add one first. if let Ok(meta) = file.metadata() && meta.len() > 0 + && let Ok(mut f) = std::fs::File::open(&gitignore) { - if let Ok(mut f) = std::fs::File::open(&gitignore) { - use std::io::Seek; - if f.seek(std::io::SeekFrom::End(-1)).is_ok() { - let mut buf = [0u8; 1]; - if f.read_exact(&mut buf).is_ok() && buf[0] != b'\n' { - let _ = writeln!(file); - } + use std::io::Seek; + if f.seek(std::io::SeekFrom::End(-1)).is_ok() { + let mut buf = [0u8; 1]; + if f.read_exact(&mut buf).is_ok() && buf[0] != b'\n' { + let _ = writeln!(file); } } } @@ -109,7 +108,7 @@ fn generate_project_doc(workspace: &Path) -> String { doc.push_str("\n"); doc.push_str("\n"); doc.push_str("\n"); - doc.push_str("\n"); + doc.push('\n'); doc.push_str("- **CodeWhale reads this file as:** \n"); doc.push_str( "- **Read-only surface:** \n", @@ -118,24 +117,24 @@ fn generate_project_doc(workspace: &Path) -> String { "- **Never edit:** \n", ); doc.push_str("- **Always test with:** \n"); - doc.push_str("\n"); + doc.push('\n'); // Architecture — the "big picture" that requires reading multiple files doc.push_str("## Architecture\n\n"); doc.push_str("\n"); doc.push_str("\n"); - doc.push_str("\n"); + doc.push('\n'); doc.push_str("### Entry Points\n"); doc.push_str( "\n", ); - doc.push_str("\n"); + doc.push('\n'); doc.push_str("### Key Modules\n"); doc.push_str("\n"); - doc.push_str("\n"); + doc.push('\n'); doc.push_str("### Data Flow\n"); doc.push_str("\n"); - doc.push_str("\n"); + doc.push('\n'); // Cache-aware editing — helps maintain prefix-cache hit rates doc.push_str("## Cache Stability\n\n"); @@ -143,11 +142,11 @@ fn generate_project_doc(workspace: &Path) -> String { doc.push_str( "\n", ); - doc.push_str("\n"); + doc.push('\n'); doc.push_str("- **Frequently-rebuilt files:** \n"); doc.push_str("- **Stable scaffolding:** \n"); doc.push_str("- **Append, don't reorder:** \n"); - doc.push_str("\n"); + doc.push('\n'); // Guidelines doc.push_str("## Guidelines\n\n"); diff --git a/crates/tui/src/tui/ui/tests.rs b/crates/tui/src/tui/ui/tests.rs index 4ec63799..9b2b981f 100644 --- a/crates/tui/src/tui/ui/tests.rs +++ b/crates/tui/src/tui/ui/tests.rs @@ -6532,7 +6532,7 @@ mod work_sidebar_projection_tests { fn receipt_summary_truncation_does_not_panic_on_multibyte_boundary() { // Build a summary where byte 57 falls mid-character (em dash is 3 bytes). // 56 ASCII chars + em dash ensures byte 57 lands inside the em dash. - let prefix: String = std::iter::repeat('a').take(56).collect(); // 56 ASCII bytes + let prefix = "a".repeat(56); // 56 ASCII bytes let summary = format!("{prefix}— rest of summary"); // byte 56='a', 57-59='—' assert!(summary.len() > 60); // Byte 57 should be inside the em dash (3-byte UTF-8 sequence).