Skip to content

Commit

Permalink
cargo clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xMAC94x committed Feb 7, 2024
1 parent cc174f1 commit d4ab195
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
6 changes: 4 additions & 2 deletions client/src/gui/components/changelog_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions client/src/gui/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
4 changes: 3 additions & 1 deletion client/src/gui/components/server_browser_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions client/src/gui/rss_feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,11 @@ impl RssPost {
.lines()
.take(3)
.filter(|x| !x.contains("[banner]"))
.map(|x| format!("{}\n", x))
.collect::<String>();
.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(),
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion client/src/io/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand Down
1 change: 0 additions & 1 deletion server/src/routes/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::sync::Arc;
use tracing::*;

#[tracing::instrument(skip(_secret, _event, metrics, payload, db))]

#[post("/", format = "json", data = "<payload>")]
pub async fn post_pipeline_update(
_secret: GitlabSecret,
Expand Down

0 comments on commit d4ab195

Please sign in to comment.