fix: clippy manual_div_ceil → .div_ceil()
This commit is contained in:
@@ -58,7 +58,7 @@ pub fn render_svg(qr: &QrCode, logo: Option<&[u8]>) -> String {
|
|||||||
/// 简易 base64 编码(无外部依赖)
|
/// 简易 base64 编码(无外部依赖)
|
||||||
fn base64_encode(data: &[u8]) -> String {
|
fn base64_encode(data: &[u8]) -> String {
|
||||||
const CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
const CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
let mut result = String::with_capacity((data.len() + 2) / 3 * 4);
|
let mut result = String::with_capacity(data.len().div_ceil(3) * 4);
|
||||||
for chunk in data.chunks(3) {
|
for chunk in data.chunks(3) {
|
||||||
let b0 = chunk[0] as u32;
|
let b0 = chunk[0] as u32;
|
||||||
let b1 = if chunk.len() > 1 { chunk[1] as u32 } else { 0 };
|
let b1 = if chunk.len() > 1 { chunk[1] as u32 } else { 0 };
|
||||||
|
|||||||
Reference in New Issue
Block a user