Skip to content

Commit a682e7b

Browse files
authored
apply clippy div_ceil suggestion (#1770)
1 parent 3379622 commit a682e7b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

base32ct/src/encoding.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub const fn encoded_len<T: Encoding>(length: usize) -> usize {
261261
} else if T::PADDED {
262262
((length - 1) / 5 + 1) * 8
263263
} else {
264-
(length * 8 + 4) / 5
264+
(length * 8).div_ceil(5)
265265
}
266266
}
267267

der_derive/src/bitstring.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl DeriveBitString {
100100
min_expected_fields += 1;
101101
}
102102
}
103-
let max_expected_bytes = (max_expected_fields + 7) / 8;
103+
let max_expected_bytes = max_expected_fields.div_ceil(8);
104104

105105
for (i, field) in self.fields.iter().enumerate().rev() {
106106
let field_name = &field.ident;

x509-cert/src/attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl AttributeTypeAndValue {
155155
};
156156

157157
// Decode der bytes from hex.
158-
let mut bytes = Vec::with_capacity((val.len() + 1) / 2);
158+
let mut bytes = Vec::with_capacity(val.len().div_ceil(2));
159159

160160
while let (Some(h), Some(l)) = (iter.next(), iter.next()) {
161161
let mut byte = 0u8;

0 commit comments

Comments
 (0)