Fix clippy lints
Some checks failed
CI / Check rust format (push) Has been cancelled
CI / Clippy (Rust stable) --no-default-features (push) Has been cancelled
CI / Clippy (Rust stable) -F cli (push) Has been cancelled
CI / Clippy (Rust stable) (push) Has been cancelled
CI / Test (Rust stable) --no-default-features (push) Has been cancelled
CI / Test (Rust stable) -F cli (push) Has been cancelled
CI / Test (Rust stable) (push) Has been cancelled
CI / Build for Windows (x86_64) (push) Has been cancelled
CI / Build for Linux (x86_64) (push) Has been cancelled
CI / Build for MacOS (arm64) (push) Has been cancelled
CI / Build for MacOS (x86_64) (push) Has been cancelled
CI / All required checks passed (push) Has been cancelled
CI / Create release (push) Has been cancelled

This commit is contained in:
Martin Michaelis 2025-07-15 20:47:55 +02:00
parent 5a7030213f
commit 5d745ab8fd
3 changed files with 4 additions and 6 deletions

View file

@ -10,10 +10,7 @@ mod cli {
pub fn generate_version_info() {
let pkg_version = env::var("CARGO_PKG_VERSION").expect("missing package version");
let git_version = git_version();
let git_prefix = git_version
.is_some()
.then_some("commit-")
.unwrap_or_default();
let git_prefix = if git_version.is_some() { "commit-" } else { "" };
let git_version = git_version.as_deref().unwrap_or("unknown");
let version = format!("{pkg_version}-git.{git_prefix}{git_version}");

View file

@ -1,4 +1,5 @@
#![warn(clippy::all, clippy::pedantic)]
#![allow(clippy::unnecessary_debug_formatting)]
use std::{fs, path::PathBuf};
@ -181,7 +182,7 @@ fn gnerate_payload(args: &mut Args) -> Result<PayloadBuffer> {
lines.iter().map(|l| l.len()).collect::<Vec<_>>()
);
}
let mut buffer = payload.add_message(style, (width + 7) / 8);
let mut buffer = payload.add_message(style, width.div_ceil(8));
for (y, line) in lines.iter().enumerate() {
for (x, c) in line.chars().enumerate() {

View file

@ -327,7 +327,7 @@ impl PayloadBuffer {
let bounds = content.bounding_box();
let width = add(bounds.top_left.x, bounds.size.width);
let mut message = self.add_message(style, (width + 7) / 8);
let mut message = self.add_message(style, width.div_ceil(8));
content.draw(&mut message).unwrap()
}