diff options
Diffstat (limited to 'crates/mozart/src/commands/suggests.rs')
| -rw-r--r-- | crates/mozart/src/commands/suggests.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/crates/mozart/src/commands/suggests.rs b/crates/mozart/src/commands/suggests.rs index 61185b2..678fd91 100644 --- a/crates/mozart/src/commands/suggests.rs +++ b/crates/mozart/src/commands/suggests.rs @@ -33,16 +33,12 @@ pub struct SuggestsArgs { pub no_dev: bool, } -// ─── Data structures ───────────────────────────────────────────────────────── - struct Suggestion { source: String, // package making the suggestion target: String, // suggested package name reason: String, // human-readable reason (may be empty) } -// ─── Main entry point ──────────────────────────────────────────────────────── - pub async fn execute( args: &SuggestsArgs, cli: &super::Cli, @@ -162,8 +158,6 @@ pub async fn execute( Ok(()) } -// ─── Suggestion collection ─────────────────────────────────────────────────── - fn collect_suggestions_from_locked( working_dir: &Path, no_dev: bool, @@ -267,8 +261,6 @@ fn collect_suggestions_from_root(working_dir: &Path) -> anyhow::Result<Vec<Sugge Ok(result) } -// ─── Installed name collection ─────────────────────────────────────────────── - fn collect_installed_names_from_lock( working_dir: &Path, no_dev: bool, @@ -379,8 +371,6 @@ fn is_platform_package(name: &str) -> bool { n == "php" || n.starts_with("php-") || n.starts_with("ext-") || n.starts_with("lib-") } -// ─── Direct deps helper ─────────────────────────────────────────────────────── - fn compute_direct_deps(working_dir: &Path) -> anyhow::Result<IndexSet<String>> { let composer_json_path = working_dir.join("composer.json"); if !composer_json_path.exists() { @@ -398,8 +388,6 @@ fn compute_direct_deps(working_dir: &Path) -> anyhow::Result<IndexSet<String>> { Ok(deps) } -// ─── Sanitization ──────────────────────────────────────────────────────────── - /// Sanitize a suggestion reason string for safe terminal output. /// Replaces newlines with spaces and strips control characters. fn sanitize_reason(reason: &str) -> String { @@ -410,8 +398,6 @@ fn sanitize_reason(reason: &str) -> String { .collect() } -// ─── Deduplication ──────────────────────────────────────────────────────────── - /// Deduplicate suggestions by (source, target) pair. /// If the same source suggests the same target multiple times, the last reason wins. /// This matches Composer's behavior where map insertion overwrites previous entries. @@ -432,8 +418,6 @@ fn deduplicate_suggestions(suggestions: Vec<Suggestion>) -> Vec<Suggestion> { deduped } -// ─── Rendering ─────────────────────────────────────────────────────────────── - fn render_list(suggestions: &[&Suggestion], console: &console::Console) { let mut targets: Vec<&str> = suggestions.iter().map(|s| s.target.as_str()).collect(); targets.sort_unstable(); @@ -501,15 +485,11 @@ fn render_by_suggestion(suggestions: &[&Suggestion], console: &console::Console) } } -// ─── Tests ─────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; use std::collections::BTreeMap; - // ── Helpers ─────────────────────────────────────────────────────────────── - fn make_suggestion(source: &str, target: &str, reason: &str) -> Suggestion { Suggestion { source: source.to_string(), @@ -595,8 +575,6 @@ mod tests { } } - // ── Deduplication tests ──────────────────────────────────────────────────── - #[test] fn test_deduplicate_keeps_last_reason() { let suggestions = vec![ @@ -636,8 +614,6 @@ mod tests { assert_eq!(deduped.len(), 2); } - // ── Filter tests ────────────────────────────────────────────────────────── - #[test] fn test_filter_removes_installed_targets() { let suggestions = [ @@ -725,8 +701,6 @@ mod tests { assert_eq!(filtered.len(), 3); } - // ── Collection tests ────────────────────────────────────────────────────── - #[test] fn test_suggests_from_lockfile() { use tempfile::tempdir; |
