chore: run clippy and cargo fmt on pending changes

This commit is contained in:
Chance 2025-04-07 23:06:48 -04:00 committed by BitSyndicate
parent db3d078935
commit 07871b77f3
8 changed files with 34 additions and 24 deletions

7
Cargo.lock generated
View file

@ -423,9 +423,7 @@ checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-link",
]
@ -2944,9 +2942,9 @@ dependencies = [
[[package]]
name = "tokio"
version = "1.44.1"
version = "1.44.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a"
checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
dependencies = [
"backtrace",
"bytes",
@ -4151,7 +4149,6 @@ dependencies = [
"bytemuck",
"cargo-lock",
"cgmath",
"chrono",
"colored",
"futures",
"image",

View file

@ -8,14 +8,13 @@ repository = "https://github.com/Zenyx-Engine/Zenyx"
# TBR (if possible)
backtrace = "0.3.74"
# TBR (if possible)
chrono = "0.4.39"
colored = "3.0.0"
parking_lot.workspace = true
# TBR (if possible)
rustyline = { version = "15.0.0", features = ["derive", "rustyline-derive"] }
thiserror = "2.0.11"
# Tokio is heavy but so far its the best option, we should make better use of it or switch to another runtime.
tokio = { version = "1.44.1", features = ["macros", "parking_lot", "rt-multi-thread"] }
tokio = { version = "1.44.2", features = ["macros", "parking_lot", "rt-multi-thread"] }
wgpu = "24.0.3"
winit = "0.30.9"
bytemuck = "1.21.0"

View file

@ -85,8 +85,7 @@ fn main() {
writeln!(
built_rs,
"{}pub static GIT_COMMIT_HASH: &str = \"{}\";",
ALLOW_DEAD_CODE,
git_info
ALLOW_DEAD_CODE, git_info
)
.unwrap();
@ -117,4 +116,4 @@ fn main() {
std::println!("cargo:rerun-if-changed=Cargo.lock");
std::println!("cargo:rerun-if-changed=.git/HEAD");
std::println!("cargo:rerun-if-changed=.git/index");
}
}

View file

@ -1,9 +1,6 @@
use std::fmt::Write as FmtWrite;
use std::mem;
use std::str::FromStr;
use std::{error::Error, path::PathBuf};
use backtrace::Backtrace;
use native_dialog::{MessageDialog, MessageType};
use parking_lot::Once;
use tracing::error;

View file

@ -5,7 +5,7 @@ use std::time::Instant;
use cgmath::{Deg, Matrix4, Point3, Rad, SquareMatrix, Vector3, perspective};
use futures::executor::block_on;
use tracing::{debug, error, info, trace};
use tracing::{debug, error, trace};
use wgpu::TextureUsages;
use wgpu::{Backends, InstanceDescriptor, util::DeviceExt};
use wgpu_text::glyph_brush::ab_glyph::FontRef;
@ -586,7 +586,7 @@ impl<'window> Renderer<'window> {
self.frame_count += 1;
let elapsed_secs = self.last_frame_instant.elapsed().as_secs_f32();
if (elapsed_secs >= 1.0) {
if elapsed_secs >= 1.0 {
let fps = self.frame_count as f32 / elapsed_secs;
// trace!("Renderer FPS: {:.2}", fps);
self.fps = fps;

View file

@ -16,6 +16,7 @@ use winit::dpi::LogicalSize;
use winit::dpi::Size;
use winit::event::{KeyEvent, WindowEvent};
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
#[cfg(target_os = "windows")]
use winit::platform::windows::WindowAttributesExtWindows;
use winit::window::Fullscreen;
use winit::window::Icon;
@ -101,8 +102,8 @@ impl App<'_> {
let win_attr = Window::default_attributes()
.with_title("Zenyx")
.with_min_inner_size(Size::Logical(LogicalSize::new(100.0, 100.0)))
.with_window_icon(icon.clone())
.with_taskbar_icon(icon);
.with_window_icon(icon.clone());
// .with_taskbar_icon(icon);
match event_loop.create_window(win_attr) {
Ok(window) => {
@ -268,8 +269,8 @@ impl App<'_> {
let base = Window::default_attributes()
.with_title(title)
.with_min_inner_size(Size::Logical(LogicalSize::new(100.0, 100.0)))
.with_window_icon(icon.clone())
.with_taskbar_icon(icon);
.with_window_icon(icon.clone());
// .with_taskbar_icon(icon);
match main_ctx.window_handle() {
Ok(handle) => {

View file

@ -1,9 +1,9 @@
use std::{
borrow::Cow::{self, Borrowed, Owned},
sync::Arc,
time::{SystemTime, UNIX_EPOCH},
};
use chrono::Local;
use colored::Colorize;
use parking_lot::Mutex;
use rustyline::{
@ -11,6 +11,7 @@ use rustyline::{
Hinter, KeyEvent, RepeatCount, Validator, completion::Completer, error::ReadlineError,
highlight::Highlighter, hint::HistoryHinter, history::DefaultHistory,
};
#[allow(unused_imports)]
use tracing::{debug, error, info, warn};
use super::handler::COMMAND_MANAGER;
@ -178,6 +179,24 @@ pub fn evaluate_command(input: &str) -> Result<()> {
Ok(())
}
fn format_time() -> String {
let now = SystemTime::now();
let duration = now.duration_since(UNIX_EPOCH).unwrap();
let total_seconds = duration.as_secs();
let nanos = duration.subsec_nanos();
let milliseconds = nanos / 1_000_000;
let seconds_since_midnight_utc = total_seconds % (24 * 3600);
let hour = (seconds_since_midnight_utc / 3600) % 24;
let minute = (seconds_since_midnight_utc / 60) % 60;
let second = seconds_since_midnight_utc % 60;
format!(
"{:02}:{:02}:{:02}.{:03}",
hour, minute, second, milliseconds
)
}
pub async fn handle_repl() -> Result<()> {
let mut rl = Editor::<MyHelper, DefaultHistory>::new()?;
rl.set_helper(Some(MyHelper {
@ -197,7 +216,7 @@ pub async fn handle_repl() -> Result<()> {
}
loop {
let time = Local::now().format("%H:%M:%S.%3f").to_string();
let time = format_time();
let prompt = format!("[{}/{}] {}", time, "SHELL", ">>\t");
let sig = rl.readline(&prompt.bright_white());

View file

@ -195,10 +195,8 @@ impl CPU {
);
sys.refresh_cpu_all();
let cpu_opt = sys.cpus().first();
let brand = cpu_opt
.map(|cpu| cpu.brand().into())
.unwrap_or(CPUBrand::Other("unknown".into()));
@ -491,7 +489,7 @@ impl EngineInfo {
rustc_version: build_info::RUSTC_VERSION.to_string(),
wgpu_version: build_info::WGPU_VERSION.to_string(),
winit_version: build_info::WGPU_VERSION.to_string(),
commit_hash: build_info::GIT_COMMIT_HASH.to_string()
commit_hash: build_info::GIT_COMMIT_HASH.to_string(),
}
}