Skip to content

Commit

Permalink
Clippy fixes (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbernier authored Nov 7, 2024
1 parent 47d5388 commit 4a904d9
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,10 @@ pub fn encode_buf<T: Into<u128>>(num: T, buf: &mut String) {
///
/// # Safety
/// - To encode all possible values of u128, the buffer must be at least 22 bytes long. However
/// a smaller buffer may be used if the value to be encoded is known to be smaller.
/// Base62 encoding adds 37.5% overhead to the size of the input.
/// a smaller buffer may be used if the value to be encoded is known to be smaller.
/// Base62 encoding adds 37.5% overhead to the size of the input.
/// - The remaining end of the buffer is left untouched. It's up to the caller to zero it using
/// the returned len if they want to.
/// the returned len if they want to.
///
/// # Example
///
Expand Down Expand Up @@ -734,10 +734,10 @@ pub fn encode_bytes<T: Into<u128>>(num: T, buf: &mut [u8]) -> Result<usize, Enco
///
/// # Safety
/// - To encode all possible values of u128, the buffer must be at least 22 bytes long. However
/// a smaller buffer may be used if the value to be encoded is known to be smaller.
/// Base62 encoding adds 37.5% overhead to the size of the input.
/// a smaller buffer may be used if the value to be encoded is known to be smaller.
/// Base62 encoding adds 37.5% overhead to the size of the input.
/// - The remaining end of the buffer is left untouched. It's up to the caller to zero it using
/// the returned len if they want to.
/// the returned len if they want to.
///
/// # Example
///
Expand Down Expand Up @@ -904,11 +904,9 @@ mod tests {
.chain(b'a' + 26..=255)
.cycle();

for size in [10, 22, 23, 40].iter().map(|&size| size) {
for size in [10, 22, 23, 40].iter().copied() {
input.clear();
for _ in 0..size {
input.push(b'0');
}
input.resize(size, b'0');

for i in 0..size {
input[i] = b'1';
Expand Down Expand Up @@ -991,11 +989,9 @@ mod tests {
.chain(b'a' + 26..=255)
.cycle();

for size in [10, 22, 23, 40].iter().map(|&size| size) {
for size in [10, 22, 23, 40].iter().copied() {
input.clear();
for _ in 0..size {
input.push(b'0');
}
input.resize(size, b'0');

for i in 0..size {
input[i] = b'1';
Expand Down

0 comments on commit 4a904d9

Please sign in to comment.