style: tidy the thin-binary split

Follow-up cleanup to the previous commit:

- rustfmt src/run.rs. The mechanical crate:: qualification pushed lines
  past 100 chars and left 'use crate::i18n::t' out of sort order; the
  original main.rs had been rustfmt-clean. Verified whitespace-only:
  the token stream is identical modulo trailing commas and that one
  import moving to its sorted position.
- Drop #![allow(dead_code)] from lib.rs. It existed because the library
  was a benches-only shim exposing modules nothing called. Now that the
  lib IS the application, it masks nothing -- cargo check is warning-free
  without it, so removing it restores real dead-code detection.
- Collapse the duplicated explanatory comments. The rationale lived in
  both lib.rs and main.rs; state it once as a lib.rs doc comment and
  leave main.rs as the three lines it should be. Full history is in
  docs/BUILDING.md.
This commit is contained in:
2026-08-07 01:13:17 +00:00
parent f8d3bb5b2b
commit 0f8493eb02
3 changed files with 559 additions and 228 deletions
+5 -9
View File
@@ -1,11 +1,8 @@
// The keydr library. This holds ALL application code, including the TUI //! keydr — terminal typing tutor with adaptive learning.
// event loop and rendering (`run`), so that everything is compiled exactly //!
// once. src/main.rs is a thin wrapper that just calls `run()`. //! All application code lives here, including the TUI event loop (`run`).
// //! `src/main.rs` is a thin wrapper so nothing is compiled twice; see
// Previously main.rs re-declared this same module tree, making the binary a //! docs/BUILDING.md. New modules belong in this file, not in main.rs.
// second independent crate: every module -- and the whole rust-i18n
// translation table generated by `i18n!` -- was compiled twice.
#![allow(dead_code)]
rust_i18n::i18n!("locales", fallback = "en"); rust_i18n::i18n!("locales", fallback = "en");
@@ -17,7 +14,6 @@ pub mod l10n;
pub mod session; pub mod session;
pub mod store; pub mod store;
// Internal to the application, but `run` needs them.
mod app; mod app;
mod event; mod event;
mod generator; mod generator;
-7
View File
@@ -1,10 +1,3 @@
// Thin entry point.
//
// All application code lives in the `keydr` library (see src/run.rs), so it
// is compiled exactly once. Previously this file re-declared the whole
// module tree (`mod app; mod config; ...`), which made the binary a second,
// separate crate — every module, and the entire rust-i18n translation
// table, was compiled twice.
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
keydr::run() keydr::run()
} }
+547 -205
View File
File diff suppressed because it is too large Load Diff