From 7d4568836dd485acf244213904e44958d8e0c9f4 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 11 May 2026 20:26:13 +0000 Subject: [PATCH] chore(authorship): remove dead LineRange::overlaps and CheckpointKind::from_str MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LineRange::overlaps had zero callers — callers of overlaps throughout the codebase target LineAttribution::overlaps(u32, u32) or Attribution::overlaps(usize, usize), which have different signatures. CheckpointKind::from_str was similarly unreachable; checkpoint kinds are matched via serde deserialization, not string parsing. Co-Authored-By: Claude Sonnet 4.6 --- src/authorship/authorship_log.rs | 15 --------------- src/authorship/working_log.rs | 16 ---------------- 2 files changed, 31 deletions(-) diff --git a/src/authorship/authorship_log.rs b/src/authorship/authorship_log.rs index 3876d492ad..65d46e03f3 100644 --- a/src/authorship/authorship_log.rs +++ b/src/authorship/authorship_log.rs @@ -24,20 +24,7 @@ impl LineRange { } } - #[allow(dead_code)] - pub fn overlaps(&self, other: &LineRange) -> bool { - match (self, other) { - (LineRange::Single(l1), LineRange::Single(l2)) => l1 == l2, - (LineRange::Single(l), LineRange::Range(start, end)) => *l >= *start && *l <= *end, - (LineRange::Range(start, end), LineRange::Single(l)) => *l >= *start && *l <= *end, - (LineRange::Range(start1, end1), LineRange::Range(start2, end2)) => { - start1 <= end2 && start2 <= end1 - } - } - } - /// Remove a line or range from this range, returning the remaining parts - #[allow(dead_code)] pub fn remove(&self, to_remove: &LineRange) -> Vec { match (self, to_remove) { (LineRange::Single(l), LineRange::Single(r)) => { @@ -125,7 +112,6 @@ impl LineRange { ranges } - #[allow(dead_code)] pub fn expand(&self) -> Vec { match self { LineRange::Single(l) => vec![*l], @@ -137,7 +123,6 @@ impl LineRange { /// - For insertions: offset is positive (shift lines down/forward) /// - For deletions: offset is negative (shift lines up/backward) /// - insertion_point: the line number where the change occurred - #[allow(dead_code)] pub fn shift(&self, insertion_point: u32, offset: i32) -> Option { // Helper: apply offset to a line number, returning None if result is negative let apply_offset = |line: u32| -> Option { diff --git a/src/authorship/working_log.rs b/src/authorship/working_log.rs index 5572263831..3b6e8d4926 100644 --- a/src/authorship/working_log.rs +++ b/src/authorship/working_log.rs @@ -60,18 +60,6 @@ impl fmt::Display for CheckpointKind { } impl CheckpointKind { - #[allow(dead_code)] - #[allow(clippy::should_implement_trait)] - pub fn from_str(s: &str) -> Self { - match s { - "human" => CheckpointKind::Human, - "ai_agent" => CheckpointKind::AiAgent, - "ai_tab" => CheckpointKind::AiTab, - "known_human" => CheckpointKind::KnownHuman, - _ => panic!("Invalid checkpoint kind: {}", s), - } - } - #[allow(clippy::wrong_self_convention)] pub fn to_str(&self) -> String { match self { @@ -254,10 +242,6 @@ mod tests { fn test_checkpoint_kind_known_human_roundtrip() { let kind = CheckpointKind::KnownHuman; assert_eq!(kind.to_str(), "known_human"); - assert_eq!( - CheckpointKind::from_str("known_human"), - CheckpointKind::KnownHuman - ); // Serde round-trip let json = serde_json::to_string(&kind).unwrap(); let back: CheckpointKind = serde_json::from_str(&json).unwrap();