Skip to content

Commit

Permalink
style: improve code formatting and readability
Browse files Browse the repository at this point in the history
  • Loading branch information
yinho999 committed Jan 26, 2025
1 parent efbd6cc commit e124196
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/auth/jwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,14 @@ mod tests {
expected_claim.extend(claims);
let expected_value = Value::from(expected_claim);

// We check between `Value` instead of `String` to avoid key ordering issues when serializing.
// It is because `expected_value` has all the keys in alphabetical order, as the `Value` serialization ensures that.
// But when serializing `input_user_claims`, first the `pid` and `exp` fields are serialized (in that order),
// and then the claims are serialized in alfabetic order. So, the resulting JSON string from the `input_user_claims` serialization
// may have the `pid` and `exp` fields unordered which differs from the `Value` serialization.
// We check between `Value` instead of `String` to avoid key ordering issues
// when serializing. It is because `expected_value` has all the keys in
// alphabetical order, as the `Value` serialization ensures that.
// But when serializing `input_user_claims`, first the `pid` and `exp` fields
// are serialized (in that order), and then the claims are serialized in
// alfabetic order. So, the resulting JSON string from the `input_user_claims`
// serialization may have the `pid` and `exp` fields unordered which
// differs from the `Value` serialization.
assert_eq!(
expected_value,
serde_json::to_value(&input_user_claims).unwrap()
Expand Down
3 changes: 2 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ impl ComponentArg {
fallback_file: fallback_file.clone(),
host: config.server.host.clone(),
port: config.server.port,
background_queue: config.workers.mode == WorkerMode::BackgroundQueue,
background_queue: config.workers.mode
== crate::config::WorkerMode::BackgroundQueue,
postgres,
sqlite,
})
Expand Down

0 comments on commit e124196

Please sign in to comment.