Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit ae630c0

Browse files
committed
chore: use variables directly in format! string
1 parent 2e42de3 commit ae630c0

File tree

5 files changed

+22
-35
lines changed

5 files changed

+22
-35
lines changed

src/constraints/types/domain_name.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,15 @@ mod tests {
5050
let domain_name = DomainName::new(case).unwrap();
5151
assert!(
5252
domain_name.validate(None).is_ok(),
53-
"DomainName '{}' should validate",
54-
case
53+
"DomainName '{case}' should validate"
5554
);
5655
assert!(
5756
domain_name.validate(Some(Target::Actor)).is_ok(),
58-
"DomainName '{}' should validate with Actor target",
59-
case
57+
"DomainName '{case}' should validate with Actor target"
6058
);
6159
assert!(
6260
domain_name.validate(Some(Target::HomeServer)).is_ok(),
63-
"DomainName '{}' should validate with HomeServer target",
64-
case
61+
"DomainName '{case}' should validate with HomeServer target"
6562
);
6663
}
6764
}
@@ -110,8 +107,7 @@ mod tests {
110107
let result = DomainName::new(case);
111108
assert!(
112109
result.is_err(),
113-
"DomainName construction should fail for invalid format: '{}'",
114-
case
110+
"DomainName construction should fail for invalid format: '{case}'"
115111
);
116112
}
117113
}

src/constraints/types/federation_id.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,15 @@ mod tests {
4747
let federation_id = FederationId::new(case).unwrap();
4848
assert!(
4949
federation_id.validate(None).is_ok(),
50-
"FederationId '{}' should validate",
51-
case
50+
"FederationId '{case}' should validate"
5251
);
5352
assert!(
5453
federation_id.validate(Some(Target::Actor)).is_ok(),
55-
"FederationId '{}' should validate with Actor target",
56-
case
54+
"FederationId '{case}' should validate with Actor target"
5755
);
5856
assert!(
5957
federation_id.validate(Some(Target::HomeServer)).is_ok(),
60-
"FederationId '{}' should validate with HomeServer target",
61-
case
58+
"FederationId '{case}' should validate with HomeServer target"
6259
);
6360
}
6461
}
@@ -93,8 +90,7 @@ mod tests {
9390
let result = FederationId::new(case);
9491
assert!(
9592
result.is_err(),
96-
"FederationId construction should fail for invalid format: '{}'",
97-
case
93+
"FederationId construction should fail for invalid format: '{case}'"
9894
);
9995
}
10096
}

src/constraints/types/local_name.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,15 @@ mod tests {
4444
let local_name = LocalName::new(case).unwrap();
4545
assert!(
4646
local_name.validate(None).is_ok(),
47-
"LocalName '{}' should validate",
48-
case
47+
"LocalName '{case}' should validate"
4948
);
5049
assert!(
5150
local_name.validate(Some(Target::Actor)).is_ok(),
52-
"LocalName '{}' should validate with Actor target",
53-
case
51+
"LocalName '{case}' should validate with Actor target"
5452
);
5553
assert!(
5654
local_name.validate(Some(Target::HomeServer)).is_ok(),
57-
"LocalName '{}' should validate with HomeServer target",
58-
case
55+
"LocalName '{case}' should validate with HomeServer target"
5956
);
6057
}
6158
}
@@ -72,8 +69,7 @@ mod tests {
7269
let result = LocalName::new(case);
7370
assert!(
7471
result.is_err(),
75-
"LocalName construction should fail for invalid format: '{}'",
76-
case
72+
"LocalName construction should fail for invalid format: '{case}'"
7773
);
7874
}
7975
}
@@ -94,8 +90,7 @@ mod tests {
9490
let local_name = LocalName::new(case).unwrap();
9591
assert!(
9692
local_name.validate(None).is_ok(),
97-
"LocalName edge case '{}' should validate",
98-
case
93+
"LocalName edge case '{case}' should validate"
9994
);
10095
}
10196
}

src/types/spki/algorithmidentifierowned.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ mod test {
140140
let json = json!(alg);
141141
let deserialized: AlgorithmIdentifierOwned = serde_json::from_value(json).unwrap();
142142
assert_eq!(alg, deserialized);
143-
trace!("deserialized: {:?}", deserialized);
144-
trace!("original: {:?}", alg);
143+
trace!("deserialized: {deserialized:?}");
144+
trace!("original: {alg:?}");
145145

146146
let bytes = [48, 6, 6, 3, 43, 6, 1, 5, 1, 4, 5, 5, 23, 2, 0, 0];
147147
let bitstring = BitString::from_bytes(&bytes).unwrap();
@@ -151,8 +151,8 @@ mod test {
151151
);
152152
let json = json!(alg);
153153
let deserialized: AlgorithmIdentifierOwned = serde_json::from_value(json).unwrap();
154-
trace!("deserialized: {:?}", deserialized);
155-
trace!("original: {:?}", alg);
154+
trace!("deserialized: {deserialized:?}");
155+
trace!("original: {alg:?}");
156156
assert_eq!(alg, deserialized);
157157
}
158158
}

tests/types/pdn.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn test_actor_dn_from_different_usernames() {
4646

4747
// Convert to ActorDN - should succeed for all valid usernames
4848
let result = ActorDN::try_from(subject_name);
49-
assert!(result.is_ok(), "Failed to convert valid certificate for user: {}", username);
49+
assert!(result.is_ok(), "Failed to convert valid certificate for user: {username}");
5050
}
5151
}
5252
}
@@ -97,7 +97,7 @@ fn test_actor_dn_missing_federation_id() {
9797
assert!(result.is_err());
9898

9999
let error = result.unwrap_err();
100-
println!("Missing Federation ID error: {}", error);
100+
println!("Missing Federation ID error: {error}");
101101
// This fails at the Name validation level before reaching ActorDN parsing
102102
assert!(error.to_string().contains("malformed") || error.to_string().contains("validation"));
103103
}
@@ -131,7 +131,7 @@ fn test_actor_dn_missing_session_id() {
131131
assert!(result.is_err());
132132

133133
let error = result.unwrap_err();
134-
println!("Missing Session ID error: {}", error);
134+
println!("Missing Session ID error: {error}");
135135
// This fails at the Name validation level before reaching ActorDN parsing
136136
assert!(error.to_string().contains("expected to be between") || error.to_string().contains("malformed"));
137137
}
@@ -149,7 +149,7 @@ fn test_actor_dn_duplicate_oid_error() {
149149
assert!(result.is_err());
150150

151151
let error = result.unwrap_err();
152-
println!("Duplicate OID error: {}", error);
152+
println!("Duplicate OID error: {error}");
153153
// This fails at the Name validation level before reaching ActorDN parsing
154154
assert!(error.to_string().contains("expected to be between") || error.to_string().contains("malformed"));
155155
}
@@ -186,7 +186,7 @@ fn test_actor_dn_roundtrip_conversion() {
186186

187187
// Convert to ActorDN - should succeed for all valid users
188188
let result = ActorDN::try_from(original_subject.clone());
189-
assert!(result.is_ok(), "Roundtrip conversion should succeed for user: {}", user);
189+
assert!(result.is_ok(), "Roundtrip conversion should succeed for user: {user}");
190190
}
191191
}
192192
}

0 commit comments

Comments
 (0)