Fix clippy::uninlined_format_args lint
All checks were successful
continuous-integration/drone/push Build is passing

Fixes local lint violations. For the final fix, I have to wait for https://github.com/kaj/ructe/pull/123
This commit is contained in:
Valentin Brandl 2023-01-28 17:04:20 +01:00
parent 9aa9b5359a
commit 83a4cb57d8
Signed by: vbrandl
GPG Key ID: CAD4DA1A789125F9
2 changed files with 17 additions and 17 deletions

View File

@ -19,13 +19,13 @@ pub enum Error {
impl fmt::Display for Error { impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
Error::Badge(s) => write!(fmt, "Badge({})", s), Error::Badge(s) => write!(fmt, "Badge({s})"),
Error::Client(e) => write!(fmt, "Client({})", e), Error::Client(e) => write!(fmt, "Client({e})"),
Error::Git(e) => write!(fmt, "Git({})", e), Error::Git(e) => write!(fmt, "Git({e})"),
Error::Internal => write!(fmt, "Internal Error"), Error::Internal => write!(fmt, "Internal Error"),
Error::Io(e) => write!(fmt, "Io({})", e), Error::Io(e) => write!(fmt, "Io({e})"),
Error::Parse(e) => write!(fmt, "Parse({})", e), Error::Parse(e) => write!(fmt, "Parse({e})"),
Error::Serial(e) => write!(fmt, "Serial({})", e), Error::Serial(e) => write!(fmt, "Serial({e})"),
Error::BranchNotFound => write!(fmt, "Repo doesn't have master branch"), Error::BranchNotFound => write!(fmt, "Repo doesn't have master branch"),
} }
} }

View File

@ -101,8 +101,8 @@ fn pull(path: impl AsRef<Path>) -> Result<()> {
} }
fn hoc(repo: &str, repo_dir: &str, cache_dir: &str, branch: &str) -> Result<(u64, String, u64)> { fn hoc(repo: &str, repo_dir: &str, cache_dir: &str, branch: &str) -> Result<(u64, String, u64)> {
let repo_dir = format!("{}/{}", repo_dir, repo); let repo_dir = format!("{repo_dir}/{repo}");
let cache_dir = format!("{}/{}.json", cache_dir, repo); let cache_dir = format!("{cache_dir}/{repo}.json");
let cache_dir = Path::new(&cache_dir); let cache_dir = Path::new(&cache_dir);
let repo = Repository::open_bare(&repo_dir)?; let repo = Repository::open_bare(&repo_dir)?;
// TODO: do better... // TODO: do better...
@ -132,8 +132,8 @@ fn hoc(repo: &str, repo_dir: &str, cache_dir: &str, branch: &str) -> Result<(u64
} }
CacheState::Old { head, .. } => { CacheState::Old { head, .. } => {
info!("Updating cache"); info!("Updating cache");
arg.push(format!("{}..{}", head, branch)); arg.push(format!("{head}..{branch}"));
arg_commit_count.push(format!("{}..{}", head, branch)); arg_commit_count.push(format!("{head}..{branch}"));
} }
CacheState::No | CacheState::NoneForBranch(..) => { CacheState::No | CacheState::NoneForBranch(..) => {
info!("Creating cache"); info!("Creating cache");
@ -214,8 +214,8 @@ where
data.1.to_lowercase() data.1.to_lowercase()
); );
info!("Deleting cache and repository"); info!("Deleting cache and repository");
let cache_dir = format!("{}/{}.json", &state.cache(), repo); let cache_dir = format!("{}/{repo}.json", &state.cache());
let repo_dir = format!("{}/{}", &state.repos(), repo); let repo_dir = format!("{}/{repo}", &state.repos());
std::fs::remove_file(cache_dir).or_else(|e| { std::fs::remove_file(cache_dir).or_else(|e| {
if e.kind() == io::ErrorKind::NotFound { if e.kind() == io::ErrorKind::NotFound {
Ok(()) Ok(())
@ -262,10 +262,10 @@ where
); );
let future = async { let future = async {
let repo = format!("{}/{}", data.0.to_lowercase(), data.1.to_lowercase()); let repo = format!("{}/{}", data.0.to_lowercase(), data.1.to_lowercase());
let service_path = format!("{}/{}", T::url_path(), repo); let service_path = format!("{}/{repo}", T::url_path());
let service_url = format!("{}/{}", T::domain(), repo); let service_url = format!("{}/{repo}", T::domain());
let path = format!("{}/{}", state.repos(), service_url); let path = format!("{}/{service_url}", state.repos());
let url = format!("https://{}", service_url); let url = format!("https://{service_url}");
let remote_exists = remote_exists(&url).await?; let remote_exists = remote_exists(&url).await?;
let file = Path::new(&path); let file = Path::new(&path);
if !file.exists() { if !file.exists() {
@ -284,7 +284,7 @@ where
let (hoc, head, commits) = hoc(&service_url, &state.repos(), &state.cache(), branch)?; let (hoc, head, commits) = hoc(&service_url, &state.repos(), &state.cache(), branch)?;
let hoc_pretty = match NumberPrefix::decimal(hoc as f64) { let hoc_pretty = match NumberPrefix::decimal(hoc as f64) {
NumberPrefix::Standalone(hoc) => hoc.to_string(), NumberPrefix::Standalone(hoc) => hoc.to_string(),
NumberPrefix::Prefixed(prefix, hoc) => format!("{:.1}{}", hoc, prefix), NumberPrefix::Prefixed(prefix, hoc) => format!("{hoc:.1}{prefix}"),
}; };
let res = HocResult::Hoc { let res = HocResult::Hoc {
hoc, hoc,