chore(workspace): finalize clippy requirements and resolve all warnings
This commit is contained in:
parent
28a6b63611
commit
32ef9ca4c6
|
|
@ -105,7 +105,7 @@ Then follow this loop on every step:
|
|||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
|
@ -225,7 +225,7 @@ cargo run -p server # run the server
|
|||
cargo test # run all tests
|
||||
cargo test -p renderer it_works # run a single test by name
|
||||
cargo check -p <crate> # fast type-check one crate
|
||||
cargo clippy --all-targets
|
||||
cargo clippy --all-targets --all-features -- -D warnings
|
||||
cargo fmt
|
||||
selene .
|
||||
stylua .
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ Then follow this loop on every step:
|
|||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
|
@ -225,7 +225,7 @@ cargo run -p server # run the server
|
|||
cargo test # run all tests
|
||||
cargo test -p renderer it_works # run a single test by name
|
||||
cargo check -p <crate> # fast type-check one crate
|
||||
cargo clippy --all-targets
|
||||
cargo clippy --all-targets --all-features -- -D warnings
|
||||
cargo fmt
|
||||
selene .
|
||||
stylua .
|
||||
|
|
|
|||
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -1281,6 +1281,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "server"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
use anyhow::{Context, Result};
|
||||
use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
|
||||
use tracing::info;
|
||||
use tracing::{error, info};
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::event::WindowEvent;
|
||||
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
|
||||
|
|
@ -21,35 +21,59 @@ impl ApplicationHandler for App {
|
|||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
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
|
||||
.display_handle()
|
||||
.expect("Failed to get display handle")
|
||||
.as_raw();
|
||||
let display_handle = match event_loop.display_handle() {
|
||||
Ok(h) => h.as_raw(),
|
||||
Err(e) => {
|
||||
error!("Failed to get display handle: {e}");
|
||||
event_loop.exit();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// Get the window handle for surface creation
|
||||
let window_handle = self
|
||||
.window
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.window_handle()
|
||||
.expect("Failed to get window handle")
|
||||
.as_raw();
|
||||
let window_handle = match window.window_handle() {
|
||||
Ok(h) => h.as_raw(),
|
||||
Err(e) => {
|
||||
error!("Failed to get window handle: {e}");
|
||||
event_loop.exit();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let required_extensions = ash_window::enumerate_required_extensions(display_handle)
|
||||
.expect("Failed to enumerate required extensions");
|
||||
let required_extensions = match ash_window::enumerate_required_extensions(display_handle) {
|
||||
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 renderer = renderer::Renderer::new(
|
||||
let size = window.inner_size();
|
||||
let renderer = match renderer::Renderer::new(
|
||||
display_handle,
|
||||
window_handle,
|
||||
size.width,
|
||||
size.height,
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -59,8 +83,9 @@ impl ApplicationHandler for App {
|
|||
event_loop.exit();
|
||||
}
|
||||
WindowEvent::RedrawRequested => {
|
||||
if let Some(renderer) = self.renderer.as_mut() {
|
||||
renderer.draw_frame().expect("Failed to draw frame");
|
||||
if let Some(Err(e)) = self.renderer.as_mut().map(renderer::Renderer::draw_frame) {
|
||||
error!("Failed to draw frame: {e}");
|
||||
event_loop.exit();
|
||||
}
|
||||
|
||||
if let Some(window) = self.window.as_ref() {
|
||||
|
|
|
|||
|
|
@ -7,3 +7,5 @@ edition = "2024"
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
//! The server handles the authoritative game simulation, including world
|
||||
//! management, physics, and combat.
|
||||
|
||||
use tracing::info;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
.init();
|
||||
|
||||
info!("Starting Project Catalyst server");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue