Skip to content

Commit 958906d

Browse files
sean-parentclaude
andcommitted
fix(begin): remove unused rel bindings and dead relationship label plumbing
Drops the unused `rel` variable bindings in `make_demo_sheet` and removes the `relationships` field and `add_relationship` method from `Labels`, which were never read by `to_graph_data` and caused dead-code errors in the renderer-agnostic clippy run. Also documents the two-invocation clippy requirement in CLAUDE.md so the begin-crate check is not missed before a PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ff5293c commit 958906d

3 files changed

Lines changed: 11 additions & 22 deletions

File tree

CLAUDE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ cargo test --doc --workspace
2727
cargo test --workspace <test_name>
2828

2929
# Lint (warnings are errors)
30-
cargo clippy --workspace -- -D warnings
31-
cargo clippy --fix --workspace
30+
# The begin crate is excluded from the workspace commands and checked separately
31+
# with --no-default-features to avoid platform-specific renderer dependencies.
32+
cargo clippy --workspace --exclude begin -- -D warnings
33+
cargo clippy -p begin --no-default-features -- -D warnings
34+
cargo clippy --fix --workspace --exclude begin
3235

3336
# Docs
3437
cargo doc --lib --no-deps --open --workspace
@@ -53,8 +56,8 @@ git checkout -b <username>/<feature-name>
5356

5457
Never commit directly to `main`.
5558

56-
Before creating a PR, run the full check suite locally (fmt, clippy, and test from the
57-
Commands section above).
59+
Before creating a PR, run the full check suite locally — every command in the Commands
60+
section above, including both clippy invocations (workspace and begin).
5861

5962
## Project Status
6063

begin/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn make_demo_sheet() -> (Sheet, Labels) {
2323
let a = sheet.add_cell(2.0_f64);
2424
let b = sheet.add_cell(3.0_f64);
2525

26-
let rel = sheet
26+
sheet
2727
.add_relationship(vec![
2828
Method::from_fn_2_1([a, b], c, |x: &f64, y: &f64| Ok(x * y)),
2929
Method::from_fn_2_1([b, c], a, |x: &f64, y: &f64| Ok(y / x)),
@@ -34,7 +34,7 @@ pub fn make_demo_sheet() -> (Sheet, Labels) {
3434
let d = sheet.add_cell(4.0_f64);
3535
let e = sheet.add_cell(5.0_f64);
3636

37-
let rel = sheet
37+
sheet
3838
.add_relationship(vec![
3939
Method::from_fn_2_1([d, e], c, |x: &f64, y: &f64| Ok(x * y)),
4040
Method::from_fn_2_1([c, e], d, |x: &f64, y: &f64| Ok(x / y)),

begin/src/bridge.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
//! with stable [`CellId`] and [`RelationshipId`] keys. [`to_graph_data`] serializes a
55
//! [`Sheet`] and its [`Labels`] into a [`GraphData`] value ready for JSON encoding.
66
7-
use std::collections::HashMap;
8-
97
use indexmap::IndexMap;
108
use property_model::{CellId, Error, RelationshipId, Sheet};
119
use serde::Serialize;
@@ -28,16 +26,13 @@ pub struct CellMeta {
2826
pub struct Labels {
2927
/// Cells in insertion order (preserves sidebar ordering).
3028
pub cells: IndexMap<CellId, CellMeta>,
31-
/// Relationship labels (reserved for future tooltip display).
32-
pub relationships: HashMap<RelationshipId, String>,
3329
}
3430

3531
impl Labels {
3632
/// Creates an empty label set.
3733
pub fn new() -> Self {
3834
Self {
3935
cells: IndexMap::new(),
40-
relationships: HashMap::new(),
4136
}
4237
}
4338

@@ -69,13 +64,6 @@ impl Labels {
6964
},
7065
);
7166
}
72-
73-
/// Registers a label for a relationship.
74-
///
75-
/// - Precondition: `id` is a live relationship in the sheet this `Labels` will be used with.
76-
pub fn add_relationship(&mut self, id: RelationshipId, label: &str) {
77-
self.relationships.insert(id, label.to_owned());
78-
}
7967
}
8068

8169
impl Default for Labels {
@@ -237,12 +225,11 @@ mod tests {
237225
let c = sheet.add_cell(0.0_f64);
238226
labels.add_cell::<f64>(c, "c");
239227

240-
let rel = sheet
228+
sheet
241229
.add_relationship(vec![Method::from_fn_2_1([a, b], c, |x: &f64, y: &f64| {
242230
Ok(x * y)
243231
})])
244232
.unwrap();
245-
labels.add_relationship(rel, "×");
246233

247234
(sheet, labels)
248235
}
@@ -341,12 +328,11 @@ mod tests {
341328
let b = sheet.add_cell(3.0_f64);
342329
labels.add_cell::<f64>(b, "b");
343330

344-
let rel = sheet
331+
sheet
345332
.add_relationship(vec![Method::from_fn_2_1([a, b], c, |x: &f64, y: &f64| {
346333
Ok(x * y)
347334
})])
348335
.unwrap();
349-
labels.add_relationship(rel, "×");
350336

351337
(sheet, labels)
352338
}

0 commit comments

Comments
 (0)