From fe99056b24034f59516b4da67cab756a05895e8e Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 25 Sep 2024 12:01:23 -0400 Subject: Re-wrap comments. --- src/clock.rs | 8 ++++---- src/id.rs | 12 +++++++----- src/repo/login/extract.rs | 7 ++++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/clock.rs b/src/clock.rs index 81ecede..4774613 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -8,10 +8,10 @@ use chrono::Utc; pub type DateTime = chrono::DateTime; -// Extractor that provides the "current time" for a request. This time is calculated -// once per request, even if the extractor is used in multiple places. This requires -// the [middleware] function to be installed with [axum::middleware::from_fn] around -// the current route. +// Extractor that provides the "current time" for a request. This time is +// calculated once per request, even if the extractor is used in multiple +// places. This requires the [middleware] function to be installed with +// [axum::middleware::from_fn] around the current route. #[derive(Clone)] pub struct RequestedAt(pub DateTime); diff --git a/src/id.rs b/src/id.rs index 5ae61e9..aec7a67 100644 --- a/src/id.rs +++ b/src/id.rs @@ -7,7 +7,8 @@ use std::fmt; // * Do not require escaping in hostnames // * Are unique up to case conversion // * Are relatively unlikely to contain cursewords -// * Are relatively unlikely to contain visually similar characters in most typefaces +// * Are relatively unlikely to contain visually similar characters in most +// typefaces // * Are not sequential // // This leaves 23 ASCII characters, or about 4.52 bits of entropy per character @@ -17,16 +18,17 @@ const ALPHABET: [char; 23] = [ 't', 'w', 'x', 'y', ]; -// Pick enough characters per ID to make accidental collisions "acceptably" unlikely -// without also making them _too_ unwieldy. This gives a fraction under 68 bits per ID. +// Pick enough characters per ID to make accidental collisions "acceptably" +// unlikely without also making them _too_ unwieldy. This gives a fraction under +// 68 bits per ID. const ID_SIZE: usize = 15; // Intended to be wrapped in a newtype that provides both type-based separation // from other identifier types, and a unique prefix to allow the intended type // of an ID to be determined by eyeball when debugging. // -// By convention, the prefix should be UPPERCASE - note that the alphabet for this -// is entirely lowercase. +// By convention, the prefix should be UPPERCASE - note that the alphabet for +// this is entirely lowercase. #[derive( Clone, Debug, diff --git a/src/repo/login/extract.rs b/src/repo/login/extract.rs index 92eb516..e5f96d0 100644 --- a/src/repo/login/extract.rs +++ b/src/repo/login/extract.rs @@ -20,7 +20,12 @@ impl FromRequestParts for Login { // After Rust 1.82 (and #[feature(min_exhaustive_patterns)] lands on // stable), the following can be replaced: // - // let Ok(identity_token) = IdentityToken::from_request_parts(parts, state).await; + // ``` + // let Ok(identity_token) = IdentityToken::from_request_parts( + // parts, + // state, + // ).await; + // ``` let identity_token = IdentityToken::from_request_parts(parts, state).await?; let RequestedAt(used_at) = RequestedAt::from_request_parts(parts, state).await?; -- cgit v1.2.3