aboutsummaryrefslogtreecommitdiff
path: root/pixel-client/src
diff options
context:
space:
mode:
Diffstat (limited to 'pixel-client/src')
-rw-r--r--pixel-client/src/game.rs10
-rw-r--r--pixel-client/src/main.rs5
-rw-r--r--pixel-client/src/menu/credits.rs2
-rw-r--r--pixel-client/src/menu/main.rs2
-rw-r--r--pixel-client/src/menu/settings.rs2
-rw-r--r--pixel-client/src/profiler.rs6
-rw-r--r--pixel-client/src/render/font.rs1
-rw-r--r--pixel-client/src/ui.rs2
8 files changed, 15 insertions, 15 deletions
diff --git a/pixel-client/src/game.rs b/pixel-client/src/game.rs
index fb81ba90..780cde42 100644
--- a/pixel-client/src/game.rs
+++ b/pixel-client/src/game.rs
@@ -371,12 +371,10 @@ impl Game {
PacketC::Communicate {
player,
message,
- timeout,
+ timeout: Some(timeout),
} => {
- if let Some(timeout) = timeout {
- if let Some(player) = self.players.get_mut(&player) {
- player.message_persist = message.map(|m| (m, timeout));
- }
+ if let Some(player) = self.players.get_mut(&player) {
+ player.message_persist = message.map(|m| (m, timeout));
}
}
PacketC::Error { message } => {
@@ -496,7 +494,7 @@ impl Player {
}
}
if let Some(item) = &self.item {
- item.draw(ctx, &item_sprites)
+ item.draw(ctx, item_sprites)
}
}
}
diff --git a/pixel-client/src/main.rs b/pixel-client/src/main.rs
index eee426b1..8b0887e5 100644
--- a/pixel-client/src/main.rs
+++ b/pixel-client/src/main.rs
@@ -163,10 +163,7 @@ fn main() -> Result<()> {
State::MainMenu(menu) => menu.keyboard_event(keycode, true),
_ => (),
},
- Event::TextInput { text, .. } => match &mut state {
- State::MainMenu(menu) => menu.ui_state.text_input(text),
- _ => (),
- },
+ Event::TextInput { text, .. } => if let State::MainMenu(menu) = &mut state { menu.ui_state.text_input(text) },
_ => {}
}
}
diff --git a/pixel-client/src/menu/credits.rs b/pixel-client/src/menu/credits.rs
index 1b3128e5..b0a74478 100644
--- a/pixel-client/src/menu/credits.rs
+++ b/pixel-client/src/menu/credits.rs
@@ -47,6 +47,6 @@ impl CreditsMenu {
});
});
- return back;
+ back
}
}
diff --git a/pixel-client/src/menu/main.rs b/pixel-client/src/menu/main.rs
index 7045931e..ce5518e2 100644
--- a/pixel-client/src/menu/main.rs
+++ b/pixel-client/src/menu/main.rs
@@ -86,7 +86,7 @@ impl MainMenu {
if ui.button(80., "Join") {
self.next_state = Some(Box::new(State::Ingame(Box::new(Game::new(
Network::connect(&self.server_address).unwrap(),
- &config,
+ config,
ui.renderer.atlas_layout(),
)))))
}
diff --git a/pixel-client/src/menu/settings.rs b/pixel-client/src/menu/settings.rs
index aef56f2f..d497ff48 100644
--- a/pixel-client/src/menu/settings.rs
+++ b/pixel-client/src/menu/settings.rs
@@ -60,6 +60,6 @@ impl SettingsMenu {
});
});
- return back;
+ back
}
}
diff --git a/pixel-client/src/profiler.rs b/pixel-client/src/profiler.rs
index 98bf8196..11703fa3 100644
--- a/pixel-client/src/profiler.rs
+++ b/pixel-client/src/profiler.rs
@@ -25,6 +25,12 @@ pub struct ProfilerOverlay {
fps: f32,
}
+impl Default for ProfilerOverlay {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl ProfilerOverlay {
pub fn new() -> Self {
Self {
diff --git a/pixel-client/src/render/font.rs b/pixel-client/src/render/font.rs
index 79e54753..54c760f1 100644
--- a/pixel-client/src/render/font.rs
+++ b/pixel-client/src/render/font.rs
@@ -27,7 +27,6 @@ impl FontTextures {
pub fn init(layout: &AtlasLayout) -> Self {
FontTextures {
glyphs: (0..128)
- .into_iter()
.map(|n| {
layout
.get(&format!("letter_{n}+a"))
diff --git a/pixel-client/src/ui.rs b/pixel-client/src/ui.rs
index 9e3e1a3e..a77d2856 100644
--- a/pixel-client/src/ui.rs
+++ b/pixel-client/src/ui.rs
@@ -204,7 +204,7 @@ impl<'a, 'b> Ui<'a, 'b> {
let margin = Vec2::splat(4.);
let text_size = self
.renderer
- .draw_text(self.cursor + margin, &content, 1., None);
+ .draw_text(self.cursor + margin, content, 1., None);
let size = margin + Vec2::new(w, text_size.y) + margin;
self.index += 1;