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:
+5
-9
@@ -1,11 +1,8 @@
|
||||
// The keydr library. This holds ALL application code, including the TUI
|
||||
// event loop and rendering (`run`), so that everything is compiled exactly
|
||||
// once. src/main.rs is a thin wrapper that just calls `run()`.
|
||||
//
|
||||
// Previously main.rs re-declared this same module tree, making the binary a
|
||||
// second independent crate: every module -- and the whole rust-i18n
|
||||
// translation table generated by `i18n!` -- was compiled twice.
|
||||
#![allow(dead_code)]
|
||||
//! keydr — terminal typing tutor with adaptive learning.
|
||||
//!
|
||||
//! All application code lives here, including the TUI event loop (`run`).
|
||||
//! `src/main.rs` is a thin wrapper so nothing is compiled twice; see
|
||||
//! docs/BUILDING.md. New modules belong in this file, not in main.rs.
|
||||
|
||||
rust_i18n::i18n!("locales", fallback = "en");
|
||||
|
||||
@@ -17,7 +14,6 @@ pub mod l10n;
|
||||
pub mod session;
|
||||
pub mod store;
|
||||
|
||||
// Internal to the application, but `run` needs them.
|
||||
mod app;
|
||||
mod event;
|
||||
mod generator;
|
||||
|
||||
@@ -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<()> {
|
||||
keydr::run()
|
||||
}
|
||||
|
||||
+554
-212
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user