chore(lints): adopt surgical clippy opt-ins workspace-wide#40
Merged
Conversation
Enable six high-signal clippy lints at workspace level and fix existing
violations across draw-core, draw-wasm, draw-webapp, draw-app, draw-cli,
and draw-py:
- manual_let_else
- missing_errors_doc
- missing_panics_doc
- redundant_closure_for_method_calls
- uninlined_format_args
- semicolon_if_nothing_returned
Pedantic as a whole, must_use_candidate, and needless_pass_by_value were
deliberately left disabled — they produce noise (f32/f64 cast spam,
getter spam) without catching real bugs in this codebase.
Notable semantics-preserving refactors driven by the new lints:
* `export_svg` assembles header + defs + body + footer in order instead
of splicing `<defs>` in via `svg.find('\n').unwrap() + 1` after the
fact, removing an unwrap on an invariant the compiler can't see.
* `find_nearest_snap_point` uses `Option::is_none_or` instead of
`.is_none() || ….unwrap()`.
* `render/draw.rs` uses `let Some(...) else { return }` for the
`Mask::new` short-circuit.
* `update_element_style` (wasm) replaces three `match { _ => return
false }` chains with `let…else`.
* `.map(|x| x.method())` → `.map(Type::method)` in wasm/core.
`# Errors` and `# Panics` sections added on `export_png`,
`export_png_with_scale`, `export_svg`, the `storage` API, `run_webapp`,
`run_app`, `run_cli`, and `Renderer::render`. Doc text describes the
actual failure surface (I/O, JSON, allocator OOM) rather than generic
boilerplate.
draw-py is its own cargo workspace so the outer `[workspace.lints]`
can't propagate; the same six lints are duplicated in its manifest.
Reviewed via `/critique` (correctness + design + performance, round 1).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Round-2 critique noted that `render_hachure_group` writes both `opacity="…"` and `style="opacity:…"` on the same <g>, and the inline style wins the cascade. The format-arg inlining in this PR touched that line, so add a TODO comment to make the bug explicit rather than silently-accepted. Fix scoped for a later PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lostmygithubaccount
added a commit
that referenced
this pull request
Apr 13, 2026
Bumps all Rust crates and the Python package from 0.2.1 to 0.3.0. This minor bump reflects one breaking change in the dkdc-draw-core public API surface (pub -> pub(crate) demotions in #42), accumulated with the non-breaking work from this cycle: - #35: arrow snap-to-shape connection points - #36: CONTRIBUTING.md + README badges - #37: integration tests for draw-core public API - #38: Rust + Python hello-world examples - #39: CHANGELOG.md scaffolding - #40: surgical clippy opt-ins workspace-wide - #41: sample gallery (5 drawings × json/svg/png) - #42: pub -> pub(crate) demotions (BREAKING) - #43: Python test coverage 5 -> 27 See CHANGELOG.md for the 0.3.0 section and migration notes for the demoted symbols. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merged
4 tasks
lostmygithubaccount
added a commit
that referenced
this pull request
Apr 13, 2026
Bumps all Rust crates and the Python package from 0.2.1 to 0.3.0. This minor bump reflects one breaking change in the dkdc-draw-core public API surface (pub -> pub(crate) demotions in #42), accumulated with the non-breaking work from this cycle: - #35: arrow snap-to-shape connection points - #36: CONTRIBUTING.md + README badges - #37: integration tests for draw-core public API - #38: Rust + Python hello-world examples - #39: CHANGELOG.md scaffolding - #40: surgical clippy opt-ins workspace-wide - #41: sample gallery (5 drawings × json/svg/png) - #42: pub -> pub(crate) demotions (BREAKING) - #43: Python test coverage 5 -> 27 See CHANGELOG.md for the 0.3.0 section and migration notes for the demoted symbols. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[workspace.lints.clippy]and fix every existing violation across all 6 crates (including draw-py, which is its own workspace and mirrors the block manually).manual_let_else,missing_errors_doc,missing_panics_doc,redundant_closure_for_method_calls,uninlined_format_args,semicolon_if_nothing_returned.must_use_candidateandneedless_pass_by_value— the f32/f64 cast warnings and getter-spam would overwhelm the real signals without catching any bugs in this codebase.Notable refactors
export_svgno longer splices<defs>in viasvg.find('\n').unwrap() + 1. Assembles header → defs → body → footer in order.find_nearest_snap_pointusesOption::is_none_orinstead ofis_none() || .unwrap().update_element_style(wasm) replaces threematch { _ => return false }chains withlet…else..map(|x| x.method())rewrites to fn-item refs where trait dispatch is unambiguous (String::as_str,Element::id,f64::to_string).# Errors/# Panicsdocs added onexport_png,export_svg, thestorageAPI,run_webapp,run_app,run_cli, andRenderer::render. Each names the actual failure surface rather than boilerplate.Reviewed via
/critiqueRound 1: correctness + design + performance reviewers. Incorporated fixes for misleading
# Panicstext onRenderer::render, over-broad# Errorsonrun_cli/run_app, duplicateexport_pngdocs, staleexport_svgcomment, and the draw-py coverage gap. Performance reviewer flagged a small extra allocation in the no-defs SVG path; kept for readability (sub-ms on realistic inputs) but documented as a possible future follow-up.Test plan
bin/checkgreen locally (fmt + clippy-D warnings+cargo test --workspace+ Python ruff/ty)