mirror of
https://github.com/fossasia/badgemagic-rs
synced 2025-07-27 22:03:58 +00:00
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
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:
parent
5a7030213f
commit
5d745ab8fd
3 changed files with 4 additions and 6 deletions
5
build.rs
5
build.rs
|
@ -10,10 +10,7 @@ mod cli {
|
||||||
pub fn generate_version_info() {
|
pub fn generate_version_info() {
|
||||||
let pkg_version = env::var("CARGO_PKG_VERSION").expect("missing package version");
|
let pkg_version = env::var("CARGO_PKG_VERSION").expect("missing package version");
|
||||||
let git_version = git_version();
|
let git_version = git_version();
|
||||||
let git_prefix = git_version
|
let git_prefix = if git_version.is_some() { "commit-" } else { "" };
|
||||||
.is_some()
|
|
||||||
.then_some("commit-")
|
|
||||||
.unwrap_or_default();
|
|
||||||
let git_version = git_version.as_deref().unwrap_or("unknown");
|
let git_version = git_version.as_deref().unwrap_or("unknown");
|
||||||
let version = format!("{pkg_version}-git.{git_prefix}{git_version}");
|
let version = format!("{pkg_version}-git.{git_prefix}{git_version}");
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#![warn(clippy::all, clippy::pedantic)]
|
#![warn(clippy::all, clippy::pedantic)]
|
||||||
|
#![allow(clippy::unnecessary_debug_formatting)]
|
||||||
|
|
||||||
use std::{fs, path::PathBuf};
|
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<_>>()
|
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 (y, line) in lines.iter().enumerate() {
|
||||||
for (x, c) in line.chars().enumerate() {
|
for (x, c) in line.chars().enumerate() {
|
||||||
|
|
|
@ -327,7 +327,7 @@ impl PayloadBuffer {
|
||||||
|
|
||||||
let bounds = content.bounding_box();
|
let bounds = content.bounding_box();
|
||||||
let width = add(bounds.top_left.x, bounds.size.width);
|
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()
|
content.draw(&mut message).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue