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:
@@ -6,7 +6,6 @@ use std::time::Duration;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::time::sleep;
|
||||
|
||||
/// Configuration for retry behavior with exponential backoff.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct BackoffConfig {
|
||||
pub max_retries: u32,
|
||||
@@ -42,7 +41,6 @@ impl BackoffConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute with retry logic and exponential backoff.
|
||||
/// Calls `on_retry(attempt, max_retries, delay)` before each retry.
|
||||
pub async fn execute_with_backoff<T, E, EFut, R, RFut>(
|
||||
config: &BackoffConfig,
|
||||
@@ -131,7 +129,8 @@ mod tests {
|
||||
assert_eq!(config.calculate_delay(1), Duration::from_millis(1000));
|
||||
assert_eq!(config.calculate_delay(2), Duration::from_millis(2000));
|
||||
assert_eq!(config.calculate_delay(3), Duration::from_millis(4000));
|
||||
assert_eq!(config.calculate_delay(6), Duration::from_millis(30000)); // capped
|
||||
// capped
|
||||
assert_eq!(config.calculate_delay(6), Duration::from_millis(30000));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -139,7 +138,8 @@ mod tests {
|
||||
let config = BackoffConfig::new(5, 500, 5000);
|
||||
assert_eq!(config.calculate_delay(1), Duration::from_millis(500));
|
||||
assert_eq!(config.calculate_delay(4), Duration::from_millis(4000));
|
||||
assert_eq!(config.calculate_delay(5), Duration::from_millis(5000)); // capped
|
||||
// capped
|
||||
assert_eq!(config.calculate_delay(5), Duration::from_millis(5000));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user