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:
@@ -35,8 +35,6 @@ macro_rules! timed {
|
||||
value
|
||||
}};
|
||||
|
||||
// Logging-only variant with explicit log level:
|
||||
// `timed!(log: info, "something", { ... })`
|
||||
(log: $lvl:ident, $name:expr, $block:block) => {{
|
||||
let start = ::std::time::Instant::now();
|
||||
let value = $block;
|
||||
@@ -45,7 +43,9 @@ macro_rules! timed {
|
||||
value
|
||||
}};
|
||||
|
||||
// Sync Result variant (no `.await` inside the block)
|
||||
// The `try:` arms wrap the block in an immediately-invoked closure (or
|
||||
// async block) so a `?` inside it returns into the macro, which can then
|
||||
// log the error and elapsed time, rather than escaping the caller.
|
||||
(try: $name:expr, $block:block) => {{
|
||||
let start = ::std::time::Instant::now();
|
||||
let result = (|| $block)();
|
||||
@@ -62,8 +62,6 @@ macro_rules! timed {
|
||||
}
|
||||
}};
|
||||
|
||||
// Sync Result variant with explicit log level:
|
||||
// `timed!(try: info, "something", { ... })?`
|
||||
(try: $lvl:ident, $name:expr, $block:block) => {{
|
||||
let start = ::std::time::Instant::now();
|
||||
let result = (|| $block)();
|
||||
@@ -80,7 +78,6 @@ macro_rules! timed {
|
||||
}
|
||||
}};
|
||||
|
||||
// Async Result variant, for blocks that use `.await` / `?`.
|
||||
(try: $name:expr, async $block:block) => {{
|
||||
let start = ::std::time::Instant::now();
|
||||
let result = (async $block).await;
|
||||
@@ -97,8 +94,6 @@ macro_rules! timed {
|
||||
}
|
||||
}};
|
||||
|
||||
// Async Result variant with explicit log level:
|
||||
// `timed!(try: info, "something", async { ... })?`
|
||||
(try: $lvl:ident, $name:expr, async $block:block) => {{
|
||||
let start = ::std::time::Instant::now();
|
||||
let result = (async $block).await;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Macros for printing messages with Unix timestamps.
|
||||
//!
|
||||
//! These macros use tracing for output, which is safe to use in headless mode
|
||||
//! (no terminal attached). The timestamp is included in the message.
|
||||
//! Output goes through tracing rather than stdout/stderr so these are safe in
|
||||
//! headless mode (no terminal attached).
|
||||
|
||||
/// Prints a message via tracing::info with a Unix timestamp prefix.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user