docs(comments): rewrite comments across all crates to the guidelines
Sweep every first-party crate source (1956 .rs files) to the project comment guidelines: delete redundant restatements, decorative banners, change narration, and end-of-line comments; keep and tighten the crucial ones (invariants, bug rationale, SAFETY blocks, ported-source attribution). No functional code changed. Every edit is proven comment-only against the prior tree by a comment-stripping lexer (string/char/raw-string aware) plus a separate doctest-fence check. Where removing a comment made rustfmt or clippy want to re-lay-out adjacent code, the minimal triggering comment is restored so code tokens stay byte-identical. Gates green: cargo fmt --all --check (0 diffs), cargo check and cargo clippy --workspace --all-targets (0 warnings). Adds scripts/check_codegen_comment_guidelines.py — the enforcement gate for these guidelines (flags banners, end-of-line comments, change narration, and commented-out code).
This commit is contained in:
@@ -10,7 +10,7 @@ pub const VERSION: &str = match option_env!("KIGI_VERSION") {
|
||||
};
|
||||
|
||||
/// [`TEST_VERSION_ENV`] override first, then [`VERSION`]. Trimmed so
|
||||
/// non-semver-aware callers can pass the result straight into parsing.
|
||||
/// callers can pass the result straight into semver parsing.
|
||||
pub fn installed() -> String {
|
||||
std::env::var(TEST_VERSION_ENV)
|
||||
.map(|v| v.trim().to_string())
|
||||
@@ -21,21 +21,12 @@ pub fn installed_semver() -> Result<Version, semver::Error> {
|
||||
Version::parse(&installed())
|
||||
}
|
||||
|
||||
/// Format the compiled version with a channel label for user-facing display.
|
||||
///
|
||||
/// `channel_label` is a pre-formatted suffix such as `" [alpha]"`, `" [stable]"`,
|
||||
/// or `""` (empty when no cached pointer is available). Obtain it from
|
||||
/// `kigi_update::channel_label()`.
|
||||
///
|
||||
/// Example: `"0.2.5 [stable]"` or `"0.2.5 [alpha]"`.
|
||||
/// `channel_label` is a pre-formatted suffix such as `" [alpha]"`, or `""` when
|
||||
/// no cached pointer is available. Obtain it from `kigi_update::channel_label()`.
|
||||
pub fn display_version(channel_label: &str) -> String {
|
||||
format!("{}{}", VERSION, channel_label)
|
||||
}
|
||||
|
||||
/// Format a version-with-commit string with a channel label.
|
||||
///
|
||||
/// Same semantics as [`display_version`] but for the full
|
||||
/// `"0.2.5 (abc1234)"` string.
|
||||
pub fn display_version_with_commit(version_with_commit: &str, channel_label: &str) -> String {
|
||||
format!("{}{}", version_with_commit, channel_label)
|
||||
}
|
||||
@@ -44,8 +35,6 @@ pub fn display_version_with_commit(version_with_commit: &str, channel_label: &st
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// Display formatting invariant matrix — verifies label appending
|
||||
/// works correctly across all label states (alpha, stable, empty).
|
||||
#[test]
|
||||
fn test_display_version_formatting_matrix() {
|
||||
let cases: &[(&str, &str, &str)] = &[
|
||||
@@ -68,7 +57,7 @@ mod tests {
|
||||
label,
|
||||
);
|
||||
}
|
||||
// display_version uses compiled VERSION — just verify the label appends
|
||||
// display_version reads the compiled VERSION, so only the suffix is assertable.
|
||||
assert_eq!(display_version(""), VERSION);
|
||||
assert!(display_version(" [stable]").ends_with("[stable]"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user