Merge commit 'dbde3c4669af10dd577590ed6980e5bd4552d13c' into feature-clean

This commit is contained in:
2025-06-19 03:45:56 +03:00
364 changed files with 8892 additions and 7026 deletions

View File

@@ -461,8 +461,7 @@ impl CacheValue {
CacheValue::Team(members) => members
.iter()
.next()
.map(|x| x.team_id.as_str())
.unwrap_or(DEFAULT_ID)
.map_or(DEFAULT_ID, |x| x.team_id.as_str())
.to_string(),
CacheValue::Organization(org) => org.id.clone(),
CacheValue::File(file) => file.hash.clone(),
@@ -556,7 +555,6 @@ macro_rules! impl_cache_methods {
$(
paste::paste! {
#[tracing::instrument(skip(pool, fetch_semaphore))]
#[allow(dead_code)]
pub async fn [<get_ $variant:snake>](
id: &str,
cache_behaviour: Option<CacheBehaviour>,
@@ -568,7 +566,6 @@ macro_rules! impl_cache_methods {
}
#[tracing::instrument(skip(pool, fetch_semaphore))]
#[allow(dead_code)]
pub async fn [<get_ $variant:snake _many>](
ids: &[&str],
cache_behaviour: Option<CacheBehaviour>,
@@ -597,7 +594,6 @@ macro_rules! impl_cache_method_singular {
$(
paste::paste! {
#[tracing::instrument(skip(pool, fetch_semaphore))]
#[allow(dead_code)]
pub async fn [<get_ $variant:snake>] (
cache_behaviour: Option<CacheBehaviour>,
pool: &SqlitePool,
@@ -735,18 +731,13 @@ impl CachedEntry {
remaining_keys.retain(|x| {
x != &&*row.id
&& !row
.alias
.as_ref()
.map(|y| {
if type_.case_sensitive_alias().unwrap_or(true)
{
x == y
} else {
y.to_lowercase() == x.to_lowercase()
}
})
.unwrap_or(false)
&& !row.alias.as_ref().is_some_and(|y| {
if type_.case_sensitive_alias().unwrap_or(true) {
x == y
} else {
y.to_lowercase() == x.to_lowercase()
}
})
});
if let Some(data) = parsed_data {
@@ -991,7 +982,7 @@ impl CachedEntry {
let key = key.to_string();
if let Some(position) = teams.iter().position(|x| {
x.first().map(|x| x.team_id == key).unwrap_or(false)
x.first().is_some_and(|x| x.team_id == key)
}) {
let team = teams.remove(position);

View File

@@ -47,9 +47,8 @@ impl DirectoryInfo {
))
})?;
let config_dir = config_dir
.map(PathBuf::from)
.unwrap_or_else(|| settings_dir.clone());
let config_dir =
config_dir.map_or_else(|| settings_dir.clone(), PathBuf::from);
Ok(Self {
settings_dir,
@@ -198,8 +197,7 @@ impl DirectoryInfo {
let move_dir = settings
.custom_dir
.as_ref()
.map(PathBuf::from)
.unwrap_or_else(|| app_dir.clone());
.map_or_else(|| app_dir.clone(), PathBuf::from);
async fn is_dir_writeable(
new_config_dir: &Path,
@@ -225,7 +223,7 @@ impl DirectoryInfo {
let disks = sysinfo::Disks::new_with_refreshed_list();
for disk in disks.iter() {
for disk in &disks {
if path.starts_with(disk.mount_point()) {
return Ok(Some(disk.available_space()));
}

View File

@@ -174,7 +174,7 @@ impl FriendsSocket {
ServerToClientMessage::FriendRequest { from } => {
let _ = emit_friend(FriendPayload::FriendRequest { from }).await;
}
ServerToClientMessage::FriendRequestRejected { .. } => todo!(),
ServerToClientMessage::FriendRequestRejected { .. } => {}, // TODO
ServerToClientMessage::FriendSocketListening { .. } => {}, // TODO
ServerToClientMessage::FriendSocketStoppedListening { .. } => {}, // TODO

View File

@@ -29,9 +29,7 @@ where
return Ok(());
};
let old_launcher_root = if let Some(dir) = default_settings_dir() {
dir
} else {
let Some(old_launcher_root) = default_settings_dir() else {
return Ok(());
};
let old_launcher_root_str = old_launcher_root.to_string_lossy().to_string();
@@ -177,12 +175,10 @@ where
let profile_path = entry.path().join("profile.json");
let profile = if let Ok(profile) =
let Ok(profile) =
read_json::<LegacyProfile>(&profile_path, &io_semaphore)
.await
{
profile
} else {
else {
continue;
};
@@ -285,7 +281,7 @@ where
TeamMember {
team_id: x.team_id,
user: user.clone(),
user,
is_owner: x.role == "Owner",
role: x.role,
ordering: x.ordering,

View File

@@ -1177,12 +1177,10 @@ fn get_date_header(headers: &HeaderMap) -> DateTime<Utc> {
.get(reqwest::header::DATE)
.and_then(|x| x.to_str().ok())
.and_then(|x| DateTime::parse_from_rfc2822(x).ok())
.map(|x| x.with_timezone(&Utc))
.unwrap_or(Utc::now())
.map_or(Utc::now(), |x| x.with_timezone(&Utc))
}
#[tracing::instrument]
#[allow(clippy::format_collect)]
fn generate_oauth_challenge() -> String {
let mut rng = rand::thread_rng();

View File

@@ -692,7 +692,7 @@ impl Process {
let mut cmd = hook.split(' ');
if let Some(command) = cmd.next() {
let mut command = Command::new(command);
command.args(cmd.collect::<Vec<&str>>()).current_dir(
command.args(cmd).current_dir(
profile::get_full_path(&profile_path).await?,
);
command.spawn().map_err(IOError::from)?;

View File

@@ -1022,8 +1022,10 @@ impl Profile {
file.hash,
file.project_type
.filter(|x| *x != ProjectType::Mod)
.map(|x| x.get_loaders().join("+"))
.unwrap_or_else(|| profile.loader.as_str().to_string()),
.map_or_else(
|| profile.loader.as_str().to_string(),
|x| x.get_loaders().join("+")
),
profile.game_version
)
}

View File

@@ -247,9 +247,13 @@ pub struct WindowSize(pub u16, pub u16);
/// Game initialization hooks
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde_with::serde_as]
pub struct Hooks {
#[serde_as(as = "serde_with::NoneAsEmptyString")]
pub pre_launch: Option<String>,
#[serde_as(as = "serde_with::NoneAsEmptyString")]
pub wrapper: Option<String>,
#[serde_as(as = "serde_with::NoneAsEmptyString")]
pub post_exit: Option<String>,
}