From b69b77b7580135f6a926d3baca2e9756745cb0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 7 Feb 2024 15:51:02 +0100 Subject: [PATCH 1/4] update to toolchain `nightly-2024-01-17` --- .gitlab-ci.yml | 2 +- rust-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 855b7e5b..be333e75 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ stages: variables: GIT_CLEAN_FLAGS: -f - CACHE_IMAGE_TAG: d74ceb0a + CACHE_IMAGE_TAG: 23a6c908 default: # https://docs.gitlab.com/ee/ci/pipelines/settings.html#auto-cancel-pending-pipelines diff --git a/rust-toolchain b/rust-toolchain index b27a258d..f1273305 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-04-20 +nightly-2024-01-17 From 863baf994e110de125642eac376ef95725986417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 7 Feb 2024 16:09:17 +0100 Subject: [PATCH 2/4] old procmacro does not compile any more --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb8d3224..f536ebae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3468,9 +3468,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] From cc174f1df7fb61aaf65330d19311e48bba28678c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 7 Feb 2024 16:16:41 +0100 Subject: [PATCH 3/4] fix compile warnings with new toolchain --- client/src/gui/components/mod.rs | 2 +- client/src/gui/rss_feed.rs | 2 +- server/src/fairings/mod.rs | 2 -- server/src/routes/api.rs | 1 + server/src/routes/gitlab.rs | 2 ++ server/src/routes/metrics.rs | 1 + server/src/routes/user.rs | 1 + 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/gui/components/mod.rs b/client/src/gui/components/mod.rs index 3f653285..cf933a8f 100644 --- a/client/src/gui/components/mod.rs +++ b/client/src/gui/components/mod.rs @@ -16,6 +16,6 @@ pub use game_panel::{GamePanelComponent, GamePanelMessage}; pub use logo_panel::LogoPanelComponent; pub use news_panel::{NewsPanelComponent, NewsPanelMessage}; pub use server_browser_panel::{ - ServerBrowserEntry, ServerBrowserPanelComponent, ServerBrowserPanelMessage, + ServerBrowserPanelComponent, ServerBrowserPanelMessage, }; pub use settings_panel::{SettingsPanelComponent, SettingsPanelMessage}; diff --git a/client/src/gui/rss_feed.rs b/client/src/gui/rss_feed.rs index c0fb40ea..972e6dda 100644 --- a/client/src/gui/rss_feed.rs +++ b/client/src/gui/rss_feed.rs @@ -89,7 +89,7 @@ pub trait RssFeedComponent { }, RssFeedComponentMessage::ImageFetched { result, url } => { if let Ok(bytes) = result { - if let Some(mut post) = self + if let Some(post) = self .posts_mut() .iter_mut() .filter(|post| post.image_url.is_some()) diff --git a/server/src/fairings/mod.rs b/server/src/fairings/mod.rs index a906f6d2..dec10232 100644 --- a/server/src/fairings/mod.rs +++ b/server/src/fairings/mod.rs @@ -1,3 +1 @@ pub mod db; - -pub use db::*; diff --git a/server/src/routes/api.rs b/server/src/routes/api.rs index f0358cb2..7e9cd043 100644 --- a/server/src/routes/api.rs +++ b/server/src/routes/api.rs @@ -1,3 +1,4 @@ +#![allow(unused_imports)] use crate::{ config::{Platform, API_VERSION}, metrics::Metrics, diff --git a/server/src/routes/gitlab.rs b/server/src/routes/gitlab.rs index 9f40358e..7382dfaf 100644 --- a/server/src/routes/gitlab.rs +++ b/server/src/routes/gitlab.rs @@ -1,3 +1,4 @@ +#![allow(unused_imports)] use crate::{ guards::{GitlabEvent, GitlabSecret}, metrics::Metrics, @@ -9,6 +10,7 @@ use std::sync::Arc; use tracing::*; #[tracing::instrument(skip(_secret, _event, metrics, payload, db))] + #[post("/", format = "json", data = "")] pub async fn post_pipeline_update( _secret: GitlabSecret, diff --git a/server/src/routes/metrics.rs b/server/src/routes/metrics.rs index 43939cdd..55a4d649 100644 --- a/server/src/routes/metrics.rs +++ b/server/src/routes/metrics.rs @@ -1,3 +1,4 @@ +#![allow(unused_imports)] use crate::{metrics::Metrics, Result}; use rocket::*; use std::sync::Arc; diff --git a/server/src/routes/user.rs b/server/src/routes/user.rs index d543426d..75d321f3 100644 --- a/server/src/routes/user.rs +++ b/server/src/routes/user.rs @@ -1,3 +1,4 @@ +#![allow(unused_imports)] use rocket::*; #[get("/")] From d4ab195d8a140de4a388de12c8a879432a192882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 7 Feb 2024 16:51:47 +0100 Subject: [PATCH 4/4] cargo clippy fixes --- client/src/gui/components/changelog_panel.rs | 6 ++++-- client/src/gui/components/mod.rs | 4 +--- client/src/gui/components/server_browser_panel.rs | 4 +++- client/src/gui/rss_feed.rs | 13 +++++++++---- client/src/io/fs.rs | 2 +- server/src/routes/gitlab.rs | 1 - 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/client/src/gui/components/changelog_panel.rs b/client/src/gui/components/changelog_panel.rs index 391c7ff5..8029a825 100644 --- a/client/src/gui/components/changelog_panel.rs +++ b/client/src/gui/components/changelog_panel.rs @@ -143,8 +143,10 @@ impl ChangelogPanelComponent { // section done // save if not empty - if section_name.is_some() && !section_lines.is_empty() { - sections.push((section_name.unwrap(), section_lines)); + if let Some(section_name) = section_name + && !section_lines.is_empty() + { + sections.push((section_name, section_lines)); } }, // paragraph without section aka note diff --git a/client/src/gui/components/mod.rs b/client/src/gui/components/mod.rs index cf933a8f..aede76dc 100644 --- a/client/src/gui/components/mod.rs +++ b/client/src/gui/components/mod.rs @@ -15,7 +15,5 @@ pub use community_showcase_panel::{ pub use game_panel::{GamePanelComponent, GamePanelMessage}; pub use logo_panel::LogoPanelComponent; pub use news_panel::{NewsPanelComponent, NewsPanelMessage}; -pub use server_browser_panel::{ - ServerBrowserPanelComponent, ServerBrowserPanelMessage, -}; +pub use server_browser_panel::{ServerBrowserPanelComponent, ServerBrowserPanelMessage}; pub use settings_panel::{SettingsPanelComponent, SettingsPanelMessage}; diff --git a/client/src/gui/components/server_browser_panel.rs b/client/src/gui/components/server_browser_panel.rs index 1e124cb1..5280ab38 100644 --- a/client/src/gui/components/server_browser_panel.rs +++ b/client/src/gui/components/server_browser_panel.rs @@ -303,7 +303,9 @@ impl ServerBrowserPanelComponent { ) .padding(0); - let row_style = if let Some(selected_index) = self.selected_index && selected_index == i { + let row_style = if let Some(selected_index) = self.selected_index + && selected_index == i + { ButtonStyle::ServerListEntry(ServerListEntryButtonState::Selected) } else { ButtonStyle::ServerListEntry(ServerListEntryButtonState::NotSelected) diff --git a/client/src/gui/rss_feed.rs b/client/src/gui/rss_feed.rs index 972e6dda..1b459a8d 100644 --- a/client/src/gui/rss_feed.rs +++ b/client/src/gui/rss_feed.rs @@ -250,8 +250,11 @@ impl RssPost { .lines() .take(3) .filter(|x| !x.contains("[banner]")) - .map(|x| format!("{}\n", x)) - .collect::(); + .fold(String::new(), |mut output, b| { + use std::fmt::Write; + let _ = writeln!(output, "{b}"); + output + }); strip_markdown::strip_markdown(&stripped_html) }, None => "No description found.".into(), @@ -272,10 +275,12 @@ impl From<&rss::Item> for RssPost { // If the RSS item has an enclosure (attached media), check if it's a jpg or png // and if it is store the URL against the post for display in the RSS // feed. - if let Some(enclosure) = &item.enclosure && matches!(enclosure.mime_type.as_str(), "image/jpg" | "image/png") { + if let Some(enclosure) = &item.enclosure + && matches!(enclosure.mime_type.as_str(), "image/jpg" | "image/png") + { let mut url = enclosure.url.clone(); - // If the image is hosted by the discord CDN, use its ability to provide a + // If the image is hosted by the discord CDN, use its ability to provide a // resized image to save bandwidth if url.starts_with("https://media.discordapp.net") { url = format!("{}?width=320&height=240", url); diff --git a/client/src/io/fs.rs b/client/src/io/fs.rs index db3c4da9..d90b0f22 100644 --- a/client/src/io/fs.rs +++ b/client/src/io/fs.rs @@ -67,7 +67,7 @@ pub fn log_path_file() -> (&'static Path, &'static str) { pub fn unzip(profile: &Profile) -> Result<()> { tracing::info!("Unzipping to {:?}", profile.directory()); let mut zip_file = - std::fs::File::open(&profile.directory().join(consts::DOWNLOAD_FILE))?; + std::fs::File::open(profile.directory().join(consts::DOWNLOAD_FILE))?; let mut archive = zip::ZipArchive::new(&mut zip_file)?; diff --git a/server/src/routes/gitlab.rs b/server/src/routes/gitlab.rs index 7382dfaf..a9de18e5 100644 --- a/server/src/routes/gitlab.rs +++ b/server/src/routes/gitlab.rs @@ -10,7 +10,6 @@ use std::sync::Arc; use tracing::*; #[tracing::instrument(skip(_secret, _event, metrics, payload, db))] - #[post("/", format = "json", data = "")] pub async fn post_pipeline_update( _secret: GitlabSecret,