From 4f4af3f3e265ceb1df4af49e88b55507eba1bf67 Mon Sep 17 00:00:00 2001 From: Pauline Date: Sat, 11 May 2024 06:37:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20chore(core):=20apply=20cargo=20c?= =?UTF-8?q?lippy=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/api/cluster/mod.rs | 3 +-- core/src/store/minecraft.rs | 6 +++++- core/src/store/package.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/api/cluster/mod.rs b/core/src/api/cluster/mod.rs index 494c6437..b9a50054 100644 --- a/core/src/api/cluster/mod.rs +++ b/core/src/api/cluster/mod.rs @@ -13,13 +13,12 @@ use crate::store::MinecraftCredentials; use crate::utils::io::{self, IOError}; -use std::collections::{HashMap}; +use std::collections::HashMap; use std::future::Future; use std::path::{Path, PathBuf}; use std::sync::Arc; -use tokio::io::AsyncReadExt; use tokio::process::Command; use tokio::sync::RwLock; diff --git a/core/src/store/minecraft.rs b/core/src/store/minecraft.rs index 12386f9f..dff16dda 100644 --- a/core/src/store/minecraft.rs +++ b/core/src/store/minecraft.rs @@ -1,5 +1,6 @@ //! Handles MSA Authentication flow. +use std::fmt::Write; use base64::Engine; use chrono::{DateTime, Utc}; use p256::ecdsa::signature::Signer; @@ -984,7 +985,10 @@ fn get_date_header(headers: &reqwest::header::HeaderMap) -> DateTime { fn generate_oauth_challenge() -> String { let mut rng = rand::thread_rng(); let bytes: Vec = (0..64).map(|_| rng.gen::()).collect(); - bytes.iter().map(|b| format!("{:02x}", b)).collect() + bytes.iter().fold(String::new(), |mut output, b| { + let _ = write!(output, "{b:02x}"); + output + }) } /// An ordered list of all MSA authentication steps. diff --git a/core/src/store/package.rs b/core/src/store/package.rs index 224152de..fb904e9f 100644 --- a/core/src/store/package.rs +++ b/core/src/store/package.rs @@ -20,7 +20,7 @@ use super::{Cluster, PackagePath}; /// Creates [`Package`] data for a given [`Cluster`] from on-device files and APIs. /// Paths must be the full paths and not relative paths. -// #[tracing::instrument(skip(paths, cluster, io_semaphore, fetch_semaphore))] +#[tracing::instrument(skip(paths, _cluster, _io_semaphore, _fetch_semaphore))] #[onelauncher_debug::debugger] pub async fn generate_context( _cluster: Cluster,