Skip to content

Commit 2ce913b

Browse files
committed
Improvements
1 parent ede4d0e commit 2ce913b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/lib/data/json/structure.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ fn unify_two_structures(
155155

156156
// Objects: must have same fields, unify field-wise
157157
(JSONStructure::Object(fields1), JSONStructure::Object(fields2)) => {
158-
// Convert to HashMaps for easier lookup
159-
let map1: HashMap<_, _> = fields1.iter().map(|(k, v)| (k, v)).collect();
160-
let map2: HashMap<_, _> = fields2.iter().map(|(k, v)| (k, v)).collect();
158+
// Convert to HashMaps for easier lookup (using owned String keys)
159+
let map1: HashMap<String, &JSONStructure> =
160+
fields1.iter().map(|(k, v)| (k.clone(), v)).collect();
161+
let map2: HashMap<String, &JSONStructure> =
162+
fields2.iter().map(|(k, v)| (k.clone(), v)).collect();
161163

162164
// Check that both objects have the same set of keys
163165
if map1.len() != map2.len() {
@@ -169,7 +171,7 @@ fn unify_two_structures(
169171
match map2.get(key) {
170172
Some(val2) => {
171173
let unified_val = unify_two_structures(val1, val2)?;
172-
unified_fields.push(((*key).clone(), unified_val));
174+
unified_fields.push((key.clone(), unified_val));
173175
}
174176
None => return Err(UnifyError::ObjectFieldMismatch),
175177
}

src/lib/data/long.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,10 +1039,6 @@ fn to_bytes_padded_impl<T: ElGamalEncryptable>(items: &[T]) -> Result<Vec<u8>, E
10391039

10401040
// Scan backwards from the end to remove external padding blocks (all-zero blocks)
10411041
// Stop when we find a non-padding block (which will have PKCS#7 padding)
1042-
if items.is_empty() {
1043-
return Err(Error::new(ErrorKind::InvalidData, "Empty data"));
1044-
}
1045-
10461042
let mut last_data_block_idx = items.len() - 1;
10471043
while last_data_block_idx > 0 {
10481044
let block = items[last_data_block_idx].to_lizard().ok_or(Error::new(

0 commit comments

Comments
 (0)