8000 Remove dead Rust: stale allow attributes, unused items, unreachable arms · Issue #307 · alexbeeken/skrongle-mini · GitHub
[go: up one dir, main page]

Skip to content

Remove dead Rust: stale allow attributes, unused items, unreachable arms #307

In review

Description

@alexbeeken

CI runs clippy only with --features dev --all-targets, so anything used only by tests or dev code never warns. cargo check --no-default-features does warn (today: TEACHER_PRESET), but CI does not fail on its warnings. First step: make that check fail on warnings, so this list cannot grow back.

allow attributes that are stale (the item is used; drop the attribute and its comment):
src/perms.rs:137 STUDENT_PRESET; src/error.rs:36, :39 NoPermission, ApiNoPermission; src/auth.rs:254 CurrentUser::require.

allow attributes hiding something dead:

  • src/auth.rs:260 CurrentUser::require_api: only tests call it.
  • src/share.rs:28 Share.created_at; src/courses.rs:505 CourseRow.created_at, .updated_at: never read ("to come"). Remove the fields and their SELECT columns.
  • src/auth/api.rs:176 Grant.user_id, .client_id: never read.
  • src/auth/api.rs:563 ApiError::NotFound: never built, tests included.
  • src/db/tables.rs USER_TABLES, SHARED_TABLES: test-only; make the module #[cfg(test)]. The per-table conditions are not used even by its own test.

No release caller, no attribute:

Location Item Only used by
src/content/quiz_type.rs:58 QuizType::is_typed nothing
src/ai/budget.rs:72 Effort::output_tokens tests
src/content.rs:667 Lesson::html_rendered tests
src/content.rs:992 ContentStore::has_conjugations the test course
src/courses.rs:245 Courses::load_builtin tests
src/courses.rs:356 Courses::builtin_store dev and tests
src/jobs.rs:325 Queue::notify the dev jobs page
src/perms.rs:100, :140 Perms::TEACHER, TEACHER_PRESET tests and dev
src/quiz.rs:52 Rng::seeded dev and tests
src/games.rs:234, src/tutor.rs:318, src/ai/queue.rs:178 three drop_user methods tests (mini has no account deletion)

Gate with #[cfg(test)] or #[cfg(feature = "dev")] what tests and dev need; delete the rest.

Parameters that are always the same: editor_page(…, notice, …) always None (src/routes/courses/editor.rs:520); hear_gap(…, gap, …) always None, so its two Some arms cannot run (src/sprint.rs:540-545); leaderboard(…, limit) always 10 (src/games.rs:272).

Arms that cannot be reached:

  • src/sprint.rs:1202-1224 and :1368: grading and describing "htype". No mini release ever dealt it and static/sprint.js has no such kind. About 25 lines plus sprint.describe.hear_type in six languages.
  • src/progress.rs:53: "legacy" => "study.via.legacy". Nothing writes it.
  • src/sprint.rs:1399-1405: three old history formats. Probably dead.
  • src/motivators.rs:210-211: "skc" to "xp". Migration v2 already rewrites every such row.
  • src/routes/mod.rs:392: a comment about refusing a blocked address with no code under it.

About 330 lines in all, with the routes and the settings shim in their own issues.

From the code review of 24 November 2026. Line numbers are as of 0.5.0 (2547b36).

Activity

  1. added
    review
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0