chore(workspace): finalize clippy requirements and resolve all warnings

This commit is contained in:
Serkyo 2026-05-12 19:03:39 +02:00
parent 28a6b63611
commit 32ef9ca4c6
6 changed files with 64 additions and 27 deletions

View file

@ -105,7 +105,7 @@ Then follow this loop on every step:
1. **Verify** the user's claimed change is actually present and correct. 1. **Verify** the user's claimed change is actually present and correct.
2. If wrong or incomplete, explain what's off and let them fix it — do not silently patch it yourself. 2. If wrong or incomplete, explain what's off and let them fix it — do not silently patch it yourself.
3. Once correct, **run the linter and formatter** (`cargo clippy --all-targets`, `cargo fmt --all`, `selene .`, and `stylua .`) to ensure no regressions or style issues were introduced. 3. Once correct, **run the linter and formatter** (`cargo clippy --all-targets --all-features -- -D warnings`, `cargo fmt --all -- --check`, `selene .`, and `stylua .`) to ensure no regressions or style issues were introduced.
4. **Ensure useful comments are added** before committing. This includes function doc comments (`///`) and inline comments above important parts of the logic. If they are missing, add them yourself and follow the documention style specified in the relevant section below. 4. **Ensure useful comments are added** before committing. This includes function doc comments (`///`) and inline comments above important parts of the logic. If they are missing, add them yourself and follow the documention style specified in the relevant section below.
5. After comments and lints are verified, **create a git commit** capturing that step (following the commit conventions above) before moving on. 5. After comments and lints are verified, **create a git commit** capturing that step (following the commit conventions above) before moving on.
6. **Then** tell the user what to do next. 6. **Then** tell the user what to do next.
@ -225,7 +225,7 @@ cargo run -p server # run the server
cargo test # run all tests cargo test # run all tests
cargo test -p renderer it_works # run a single test by name cargo test -p renderer it_works # run a single test by name
cargo check -p <crate> # fast type-check one crate cargo check -p <crate> # fast type-check one crate
cargo clippy --all-targets cargo clippy --all-targets --all-features -- -D warnings
cargo fmt cargo fmt
selene . selene .
stylua . stylua .

View file

@ -105,7 +105,7 @@ Then follow this loop on every step:
1. **Verify** the user's claimed change is actually present and correct. 1. **Verify** the user's claimed change is actually present and correct.
2. If wrong or incomplete, explain what's off and let them fix it — do not silently patch it yourself. 2. If wrong or incomplete, explain what's off and let them fix it — do not silently patch it yourself.
3. Once correct, **run the linter and formatter** (`cargo clippy --all-targets`, `cargo fmt --all`, `selene .`, and `stylua .`) to ensure no regressions or style issues were introduced. 3. Once correct, **run the linter and formatter** (`cargo clippy --all-targets --all-features -- -D warnings`, `cargo fmt --all -- --check`, `selene .`, and `stylua .`) to ensure no regressions or style issues were introduced.
4. **Ensure useful comments are added** before committing. This includes function doc comments (`///`) and inline comments above important parts of the logic. If they are missing, add them yourself and follow the documention style specified in the relevant section below. 4. **Ensure useful comments are added** before committing. This includes function doc comments (`///`) and inline comments above important parts of the logic. If they are missing, add them yourself and follow the documention style specified in the relevant section below.
5. After comments and lints are verified, **create a git commit** capturing that step (following the commit conventions above) before moving on. 5. After comments and lints are verified, **create a git commit** capturing that step (following the commit conventions above) before moving on.
6. **Then** tell the user what to do next. 6. **Then** tell the user what to do next.
@ -225,7 +225,7 @@ cargo run -p server # run the server
cargo test # run all tests cargo test # run all tests
cargo test -p renderer it_works # run a single test by name cargo test -p renderer it_works # run a single test by name
cargo check -p <crate> # fast type-check one crate cargo check -p <crate> # fast type-check one crate
cargo clippy --all-targets cargo clippy --all-targets --all-features -- -D warnings
cargo fmt cargo fmt
selene . selene .
stylua . stylua .

4
Cargo.lock generated
View file

@ -1281,6 +1281,10 @@ dependencies = [
[[package]] [[package]]
name = "server" name = "server"
version = "0.1.0" version = "0.1.0"
dependencies = [
"tracing",
"tracing-subscriber",
]
[[package]] [[package]]
name = "sharded-slab" name = "sharded-slab"

View file

@ -5,7 +5,7 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use raw_window_handle::{HasDisplayHandle, HasWindowHandle}; use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
use tracing::info; use tracing::{error, info};
use winit::application::ApplicationHandler; use winit::application::ApplicationHandler;
use winit::event::WindowEvent; use winit::event::WindowEvent;
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop}; use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
@ -21,35 +21,59 @@ impl ApplicationHandler for App {
fn resumed(&mut self, event_loop: &ActiveEventLoop) { fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let attributes = Window::default_attributes().with_title("Project Catalyst"); let attributes = Window::default_attributes().with_title("Project Catalyst");
self.window = Some(event_loop.create_window(attributes).unwrap()); let window = match event_loop.create_window(attributes) {
Ok(w) => w,
Err(e) => {
error!("Failed to create window: {e}");
event_loop.exit();
return;
}
};
let display_handle = event_loop let display_handle = match event_loop.display_handle() {
.display_handle() Ok(h) => h.as_raw(),
.expect("Failed to get display handle") Err(e) => {
.as_raw(); error!("Failed to get display handle: {e}");
event_loop.exit();
return;
}
};
// Get the window handle for surface creation let window_handle = match window.window_handle() {
let window_handle = self Ok(h) => h.as_raw(),
.window Err(e) => {
.as_ref() error!("Failed to get window handle: {e}");
.unwrap() event_loop.exit();
.window_handle() return;
.expect("Failed to get window handle") }
.as_raw(); };
let required_extensions = ash_window::enumerate_required_extensions(display_handle) let required_extensions = match ash_window::enumerate_required_extensions(display_handle) {
.expect("Failed to enumerate required extensions"); Ok(exts) => exts,
Err(e) => {
error!("Failed to enumerate required extensions: {e}");
event_loop.exit();
return;
}
};
let size = self.window.as_ref().unwrap().inner_size(); let size = window.inner_size();
let renderer = renderer::Renderer::new( let renderer = match renderer::Renderer::new(
display_handle, display_handle,
window_handle, window_handle,
size.width, size.width,
size.height, size.height,
required_extensions, required_extensions,
) ) {
.expect("Failed to initialize Vulkan renderer"); Ok(r) => r,
Err(e) => {
error!("Failed to initialize Vulkan renderer: {e}");
event_loop.exit();
return;
}
};
self.window = Some(window);
self.renderer = Some(renderer); self.renderer = Some(renderer);
} }
@ -59,8 +83,9 @@ impl ApplicationHandler for App {
event_loop.exit(); event_loop.exit();
} }
WindowEvent::RedrawRequested => { WindowEvent::RedrawRequested => {
if let Some(renderer) = self.renderer.as_mut() { if let Some(Err(e)) = self.renderer.as_mut().map(renderer::Renderer::draw_frame) {
renderer.draw_frame().expect("Failed to draw frame"); error!("Failed to draw frame: {e}");
event_loop.exit();
} }
if let Some(window) = self.window.as_ref() { if let Some(window) = self.window.as_ref() {

View file

@ -7,3 +7,5 @@ edition = "2024"
workspace = true workspace = true
[dependencies] [dependencies]
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }

View file

@ -3,6 +3,12 @@
//! The server handles the authoritative game simulation, including world //! The server handles the authoritative game simulation, including world
//! management, physics, and combat. //! management, physics, and combat.
use tracing::info;
fn main() { fn main() {
println!("Hello, world!"); tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init();
info!("Starting Project Catalyst server");
} }