File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -995,15 +995,31 @@ impl RustApi {
995995 fn base64_encode ( input : & [ u8 ] ) -> String {
996996 const ALPHA : & [ u8 ; 64 ] =
997997 b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ;
998- let mut out = String :: with_capacity ( ( input. len ( ) + 2 ) / 3 * 4 ) ;
998+ let mut out = String :: with_capacity ( input. len ( ) . div_ceil ( 3 ) * 4 ) ;
999999 for chunk in input. chunks ( 3 ) {
10001000 let b0 = chunk[ 0 ] as usize ;
1001- let b1 = if chunk. len ( ) > 1 { chunk[ 1 ] as usize } else { 0 } ;
1002- let b2 = if chunk. len ( ) > 2 { chunk[ 2 ] as usize } else { 0 } ;
1001+ let b1 = if chunk. len ( ) > 1 {
1002+ chunk[ 1 ] as usize
1003+ } else {
1004+ 0
1005+ } ;
1006+ let b2 = if chunk. len ( ) > 2 {
1007+ chunk[ 2 ] as usize
1008+ } else {
1009+ 0
1010+ } ;
10031011 out. push ( ALPHA [ b0 >> 2 ] as char ) ;
10041012 out. push ( ALPHA [ ( ( b0 & 3 ) << 4 ) | ( b1 >> 4 ) ] as char ) ;
1005- out. push ( if chunk. len ( ) > 1 { ALPHA [ ( ( b1 & 0xf ) << 2 ) | ( b2 >> 6 ) ] as char } else { '=' } ) ;
1006- out. push ( if chunk. len ( ) > 2 { ALPHA [ b2 & 63 ] as char } else { '=' } ) ;
1013+ out. push ( if chunk. len ( ) > 1 {
1014+ ALPHA [ ( ( b1 & 0xf ) << 2 ) | ( b2 >> 6 ) ] as char
1015+ } else {
1016+ '='
1017+ } ) ;
1018+ out. push ( if chunk. len ( ) > 2 {
1019+ ALPHA [ b2 & 63 ] as char
1020+ } else {
1021+ '='
1022+ } ) ;
10071023 }
10081024 out
10091025 }
Original file line number Diff line number Diff line change 2424//! ```
2525
2626use rustapi_core:: health:: { HealthCheck , HealthCheckBuilder , HealthStatus } ;
27+ use std:: fmt;
2728use std:: sync:: Arc ;
2829use std:: time:: Duration ;
29- use std:: fmt;
3030
3131/// Error type for Diesel pool operations
3232#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -44,11 +44,15 @@ impl std::error::Error for ExportError {
4444}
4545
4646impl From < std:: io:: Error > for ExportError {
47- fn from ( e : std:: io:: Error ) -> Self { Self :: Io ( e) }
47+ fn from ( e : std:: io:: Error ) -> Self {
48+ Self :: Io ( e)
49+ }
4850}
4951
5052impl From < serde_json:: Error > for ExportError {
51- fn from ( e : serde_json:: Error ) -> Self { Self :: Serialization ( e) }
53+ fn from ( e : serde_json:: Error ) -> Self {
54+ Self :: Serialization ( e)
55+ }
5256}
5357
5458/// Result type for export operations.
Original file line number Diff line number Diff line change @@ -32,7 +32,9 @@ impl std::error::Error for ReplayClientError {
3232}
3333
3434impl From < reqwest:: Error > for ReplayClientError {
35- fn from ( e : reqwest:: Error ) -> Self { Self :: Http ( e) }
35+ fn from ( e : reqwest:: Error ) -> Self {
36+ Self :: Http ( e)
37+ }
3638}
3739
3840/// HTTP client for replaying recorded requests against a target server.
Original file line number Diff line number Diff line change @@ -93,7 +93,9 @@ impl std::error::Error for PoolError {
9393}
9494
9595impl From < sqlx:: Error > for PoolError {
96- fn from ( e : sqlx:: Error ) -> Self { Self :: Sqlx ( e) }
96+ fn from ( e : sqlx:: Error ) -> Self {
97+ Self :: Sqlx ( e)
98+ }
9799}
98100
99101/// Configuration for SQLx connection pool
Original file line number Diff line number Diff line change @@ -28,16 +28,12 @@ pub struct JobRequest {
2828/// Backend storage for jobs (dyn-compatible via boxed futures)
2929pub trait JobBackend : Send + Sync {
3030 /// Push a new job to the queue
31- fn push < ' a > (
32- & ' a self ,
33- job : JobRequest ,
34- ) -> Pin < Box < dyn Future < Output = Result < ( ) > > + Send + ' a > > ;
31+ fn push < ' a > ( & ' a self , job : JobRequest )
32+ -> Pin < Box < dyn Future < Output = Result < ( ) > > + Send + ' a > > ;
3533
3634 /// Pop the next available job
3735 /// Should return None if no job is available or ready
38- fn pop < ' a > (
39- & ' a self ,
40- ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > ;
36+ fn pop < ' a > ( & ' a self ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > ;
4137
4238 /// Mark a job as completed successfully
4339 fn complete < ' a > (
Original file line number Diff line number Diff line change @@ -33,9 +33,7 @@ impl JobBackend for InMemoryBackend {
3333 } )
3434 }
3535
36- fn pop < ' a > (
37- & ' a self ,
38- ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > {
36+ fn pop < ' a > ( & ' a self ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > {
3937 Box :: pin ( async move {
4038 let mut q = self
4139 . queue
Original file line number Diff line number Diff line change @@ -78,9 +78,7 @@ impl JobBackend for PostgresBackend {
7878 } )
7979 }
8080
81- fn pop < ' a > (
82- & ' a self ,
83- ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > {
81+ fn pop < ' a > ( & ' a self ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > {
8482 Box :: pin ( async move {
8583 // Atomic pop using DELETE ... RETURNING with locking
8684 let query = format ! (
Original file line number Diff line number Diff line change @@ -62,9 +62,7 @@ impl JobBackend for RedisBackend {
6262 } )
6363 }
6464
65- fn pop < ' a > (
66- & ' a self ,
67- ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > {
65+ fn pop < ' a > ( & ' a self ) -> Pin < Box < dyn Future < Output = Result < Option < JobRequest > > > + Send + ' a > > {
6866 Box :: pin ( async move {
6967 let mut conn = self
7068 . client
Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ impl std::error::Error for JobError {
3333}
3434
3535impl From < serde_json:: Error > for JobError {
36- fn from ( e : serde_json:: Error ) -> Self { Self :: SerializationError ( e) }
36+ fn from ( e : serde_json:: Error ) -> Self {
37+ Self :: SerializationError ( e)
38+ }
3739}
3840
3941pub type Result < T > = std:: result:: Result < T , JobError > ;
You can’t perform that action at this time.
0 commit comments