Pedantic clippy moment

main
Michal 2 years ago
parent 5e4487733c
commit 2d651b75e5
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -4,6 +4,7 @@ version = "2.0.0"
authors = [ "michal <michal@tar.black>" ]
edition = "2021"
description = "Packaging tool for pacman repositories"
repository = "https://github.com/crystal-linux/malachite"
license-file = "LICENSE"
keywords = [ "pacman", "repository", "packaging" ]
categories = [ "filesystem", "development-tools" ]

@ -10,31 +10,29 @@ const ERR_SYMBOL: &str = "❌";
#[macro_export]
macro_rules! info {
($($arg:tt)+) => {
$crate::internal::strings::info_fn(format!($($arg)+));
$crate::internal::strings::info_fn(&format!($($arg)+));
}
}
#[macro_export]
macro_rules! log {
($verbose:expr, $($arg:tt)+) => {
$crate::internal::strings::log_fn(format!("{}:{} {}", file!(), line!(), format!($($arg)+)), $verbose);
$crate::internal::strings::log_fn(&format!("{}:{} {}", file!(), line!(), format!($($arg)+)), $verbose);
}
}
#[macro_export]
macro_rules! crash {
($exit_code:expr, $($arg:tt)+) => {
$crate::internal::strings::crash_fn(format!($($arg)+), $exit_code)
$crate::internal::strings::crash_fn(&format!($($arg)+), $exit_code)
}
}
pub fn info_fn<S: ToString>(msg: S) {
let msg = msg.to_string();
pub fn info_fn(msg: &str) {
println!("{} {}", LOGO_SYMBOL.black(), msg.bold());
}
pub fn log_fn<S: ToString>(msg: S, verbose: bool) {
let msg = msg.to_string();
pub fn log_fn(msg: &str, verbose: bool) {
if verbose {
eprintln!(
"{} {}",
@ -47,8 +45,7 @@ pub fn log_fn<S: ToString>(msg: S, verbose: bool) {
}
}
pub fn crash_fn<S: ToString>(msg: S, exit_code: AppExitCode) {
let msg = msg.to_string();
pub fn crash_fn(msg: &str, exit_code: AppExitCode) {
println!("{} {}", ERR_SYMBOL.red(), msg.bold());
exit(exit_code as i32);
}

@ -1,4 +1,4 @@
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
use clap::Parser;
use std::env;

Loading…
Cancel
Save