chore: run clippy and cargo fmt on pending changes
This commit is contained in:
parent
2b71c2d63b
commit
06cb7f9bec
8 changed files with 34 additions and 24 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -423,9 +423,7 @@ checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"js-sys",
|
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"wasm-bindgen",
|
|
||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2944,9 +2942,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.44.1"
|
version = "1.44.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a"
|
checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -4151,7 +4149,6 @@ dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cargo-lock",
|
"cargo-lock",
|
||||||
"cgmath",
|
"cgmath",
|
||||||
"chrono",
|
|
||||||
"colored",
|
"colored",
|
||||||
"futures",
|
"futures",
|
||||||
"image",
|
"image",
|
||||||
|
|
|
@ -8,14 +8,13 @@ repository = "https://github.com/Zenyx-Engine/Zenyx"
|
||||||
# TBR (if possible)
|
# TBR (if possible)
|
||||||
backtrace = "0.3.74"
|
backtrace = "0.3.74"
|
||||||
# TBR (if possible)
|
# TBR (if possible)
|
||||||
chrono = "0.4.39"
|
|
||||||
colored = "3.0.0"
|
colored = "3.0.0"
|
||||||
parking_lot.workspace = true
|
parking_lot.workspace = true
|
||||||
# TBR (if possible)
|
# TBR (if possible)
|
||||||
rustyline = { version = "15.0.0", features = ["derive", "rustyline-derive"] }
|
rustyline = { version = "15.0.0", features = ["derive", "rustyline-derive"] }
|
||||||
thiserror = "2.0.11"
|
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 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"
|
wgpu = "24.0.3"
|
||||||
winit = "0.30.9"
|
winit = "0.30.9"
|
||||||
bytemuck = "1.21.0"
|
bytemuck = "1.21.0"
|
||||||
|
|
|
@ -85,8 +85,7 @@ fn main() {
|
||||||
writeln!(
|
writeln!(
|
||||||
built_rs,
|
built_rs,
|
||||||
"{}pub static GIT_COMMIT_HASH: &str = \"{}\";",
|
"{}pub static GIT_COMMIT_HASH: &str = \"{}\";",
|
||||||
ALLOW_DEAD_CODE,
|
ALLOW_DEAD_CODE, git_info
|
||||||
git_info
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
use std::fmt::Write as FmtWrite;
|
|
||||||
use std::mem;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::{error::Error, path::PathBuf};
|
use std::{error::Error, path::PathBuf};
|
||||||
|
|
||||||
use backtrace::Backtrace;
|
|
||||||
use native_dialog::{MessageDialog, MessageType};
|
use native_dialog::{MessageDialog, MessageType};
|
||||||
use parking_lot::Once;
|
use parking_lot::Once;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::time::Instant;
|
||||||
|
|
||||||
use cgmath::{Deg, Matrix4, Point3, Rad, SquareMatrix, Vector3, perspective};
|
use cgmath::{Deg, Matrix4, Point3, Rad, SquareMatrix, Vector3, perspective};
|
||||||
use futures::executor::block_on;
|
use futures::executor::block_on;
|
||||||
use tracing::{debug, error, info, trace};
|
use tracing::{debug, error, trace};
|
||||||
use wgpu::TextureUsages;
|
use wgpu::TextureUsages;
|
||||||
use wgpu::{Backends, InstanceDescriptor, util::DeviceExt};
|
use wgpu::{Backends, InstanceDescriptor, util::DeviceExt};
|
||||||
use wgpu_text::glyph_brush::ab_glyph::FontRef;
|
use wgpu_text::glyph_brush::ab_glyph::FontRef;
|
||||||
|
@ -586,7 +586,7 @@ impl<'window> Renderer<'window> {
|
||||||
self.frame_count += 1;
|
self.frame_count += 1;
|
||||||
|
|
||||||
let elapsed_secs = self.last_frame_instant.elapsed().as_secs_f32();
|
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;
|
let fps = self.frame_count as f32 / elapsed_secs;
|
||||||
// trace!("Renderer FPS: {:.2}", fps);
|
// trace!("Renderer FPS: {:.2}", fps);
|
||||||
self.fps = fps;
|
self.fps = fps;
|
||||||
|
|
|
@ -16,6 +16,7 @@ use winit::dpi::LogicalSize;
|
||||||
use winit::dpi::Size;
|
use winit::dpi::Size;
|
||||||
use winit::event::{KeyEvent, WindowEvent};
|
use winit::event::{KeyEvent, WindowEvent};
|
||||||
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
|
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
use winit::platform::windows::WindowAttributesExtWindows;
|
use winit::platform::windows::WindowAttributesExtWindows;
|
||||||
use winit::window::Fullscreen;
|
use winit::window::Fullscreen;
|
||||||
use winit::window::Icon;
|
use winit::window::Icon;
|
||||||
|
@ -101,8 +102,8 @@ impl App<'_> {
|
||||||
let win_attr = Window::default_attributes()
|
let win_attr = Window::default_attributes()
|
||||||
.with_title("Zenyx")
|
.with_title("Zenyx")
|
||||||
.with_min_inner_size(Size::Logical(LogicalSize::new(100.0, 100.0)))
|
.with_min_inner_size(Size::Logical(LogicalSize::new(100.0, 100.0)))
|
||||||
.with_window_icon(icon.clone())
|
.with_window_icon(icon.clone());
|
||||||
.with_taskbar_icon(icon);
|
// .with_taskbar_icon(icon);
|
||||||
|
|
||||||
match event_loop.create_window(win_attr) {
|
match event_loop.create_window(win_attr) {
|
||||||
Ok(window) => {
|
Ok(window) => {
|
||||||
|
@ -268,8 +269,8 @@ impl App<'_> {
|
||||||
let base = Window::default_attributes()
|
let base = Window::default_attributes()
|
||||||
.with_title(title)
|
.with_title(title)
|
||||||
.with_min_inner_size(Size::Logical(LogicalSize::new(100.0, 100.0)))
|
.with_min_inner_size(Size::Logical(LogicalSize::new(100.0, 100.0)))
|
||||||
.with_window_icon(icon.clone())
|
.with_window_icon(icon.clone());
|
||||||
.with_taskbar_icon(icon);
|
// .with_taskbar_icon(icon);
|
||||||
|
|
||||||
match main_ctx.window_handle() {
|
match main_ctx.window_handle() {
|
||||||
Ok(handle) => {
|
Ok(handle) => {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use std::{
|
use std::{
|
||||||
borrow::Cow::{self, Borrowed, Owned},
|
borrow::Cow::{self, Borrowed, Owned},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
use chrono::Local;
|
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use rustyline::{
|
use rustyline::{
|
||||||
|
@ -11,6 +11,7 @@ use rustyline::{
|
||||||
Hinter, KeyEvent, RepeatCount, Validator, completion::Completer, error::ReadlineError,
|
Hinter, KeyEvent, RepeatCount, Validator, completion::Completer, error::ReadlineError,
|
||||||
highlight::Highlighter, hint::HistoryHinter, history::DefaultHistory,
|
highlight::Highlighter, hint::HistoryHinter, history::DefaultHistory,
|
||||||
};
|
};
|
||||||
|
#[allow(unused_imports)]
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
|
|
||||||
use super::handler::COMMAND_MANAGER;
|
use super::handler::COMMAND_MANAGER;
|
||||||
|
@ -178,6 +179,24 @@ pub fn evaluate_command(input: &str) -> Result<()> {
|
||||||
Ok(())
|
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<()> {
|
pub async fn handle_repl() -> Result<()> {
|
||||||
let mut rl = Editor::<MyHelper, DefaultHistory>::new()?;
|
let mut rl = Editor::<MyHelper, DefaultHistory>::new()?;
|
||||||
rl.set_helper(Some(MyHelper {
|
rl.set_helper(Some(MyHelper {
|
||||||
|
@ -197,7 +216,7 @@ pub async fn handle_repl() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let time = Local::now().format("%H:%M:%S.%3f").to_string();
|
let time = format_time();
|
||||||
let prompt = format!("[{}/{}] {}", time, "SHELL", ">>\t");
|
let prompt = format!("[{}/{}] {}", time, "SHELL", ">>\t");
|
||||||
let sig = rl.readline(&prompt.bright_white());
|
let sig = rl.readline(&prompt.bright_white());
|
||||||
|
|
||||||
|
|
|
@ -195,10 +195,8 @@ impl CPU {
|
||||||
);
|
);
|
||||||
sys.refresh_cpu_all();
|
sys.refresh_cpu_all();
|
||||||
|
|
||||||
|
|
||||||
let cpu_opt = sys.cpus().first();
|
let cpu_opt = sys.cpus().first();
|
||||||
|
|
||||||
|
|
||||||
let brand = cpu_opt
|
let brand = cpu_opt
|
||||||
.map(|cpu| cpu.brand().into())
|
.map(|cpu| cpu.brand().into())
|
||||||
.unwrap_or(CPUBrand::Other("unknown".into()));
|
.unwrap_or(CPUBrand::Other("unknown".into()));
|
||||||
|
@ -491,7 +489,7 @@ impl EngineInfo {
|
||||||
rustc_version: build_info::RUSTC_VERSION.to_string(),
|
rustc_version: build_info::RUSTC_VERSION.to_string(),
|
||||||
wgpu_version: build_info::WGPU_VERSION.to_string(),
|
wgpu_version: build_info::WGPU_VERSION.to_string(),
|
||||||
winit_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(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue