From 56b95b8fff330d317587af837bc424258a21ea15 Mon Sep 17 00:00:00 2001 From: vmarcella Date: Sun, 28 Sep 2025 00:06:25 -0700 Subject: [PATCH 1/3] [update] documentation and fix security pipeline. --- .github/workflows/lambda-repo-security.yml | 14 ++-- crates/lambda-rs-args/examples/basic.rs | 7 +- crates/lambda-rs-args/examples/bools.rs | 6 +- crates/lambda-rs-args/examples/env_config.rs | 6 +- crates/lambda-rs-args/examples/equals.rs | 6 +- crates/lambda-rs-args/examples/exclusives.rs | 7 +- crates/lambda-rs-args/examples/positionals.rs | 6 +- crates/lambda-rs-args/examples/short_count.rs | 6 +- crates/lambda-rs-args/examples/subcommands.rs | 6 +- crates/lambda-rs-args/src/lib.rs | 79 +++++++++++++++---- crates/lambda-rs-logging/src/handler.rs | 12 +-- crates/lambda-rs-logging/src/lib.rs | 1 + crates/lambda-rs-platform/src/lib.rs | 7 ++ crates/lambda-rs-platform/src/obj/mod.rs | 15 ++-- crates/lambda-rs-platform/src/rand/mod.rs | 4 + crates/lambda-rs-platform/src/shader/mod.rs | 20 +---- crates/lambda-rs-platform/src/shader/naga.rs | 11 +-- .../src/shader/shaderc_backend.rs | 5 +- crates/lambda-rs-platform/src/shaderc.rs | 5 +- crates/lambda-rs-platform/src/wgpu/mod.rs | 5 +- crates/lambda-rs-platform/src/winit/mod.rs | 35 ++------ crates/lambda-rs/examples/minimal.rs | 6 +- crates/lambda-rs/examples/push_constants.rs | 38 ++------- crates/lambda-rs/examples/triangle.rs | 26 ++---- crates/lambda-rs/examples/triangles.rs | 28 ++----- crates/lambda-rs/src/component.rs | 10 +-- crates/lambda-rs/src/lib.rs | 1 + crates/lambda-rs/src/math/matrix.rs | 16 +--- crates/lambda-rs/src/math/mod.rs | 7 ++ crates/lambda-rs/src/render/buffer.rs | 13 +-- crates/lambda-rs/src/render/command.rs | 5 +- crates/lambda-rs/src/render/mesh.rs | 6 +- crates/lambda-rs/src/render/mod.rs | 12 +-- crates/lambda-rs/src/render/pipeline.rs | 13 +-- crates/lambda-rs/src/render/shader.rs | 5 +- crates/lambda-rs/src/render/window.rs | 10 ++- crates/lambda-rs/src/runtimes/application.rs | 36 ++++----- crates/lambda-rs/src/runtimes/mod.rs | 8 +- crates/lambda-rs/tests/runnables.rs | 1 + tools/obj_loader/src/main.rs | 48 +++-------- 40 files changed, 204 insertions(+), 348 deletions(-) diff --git a/.github/workflows/lambda-repo-security.yml b/.github/workflows/lambda-repo-security.yml index e60250d1..1f9df3bc 100644 --- a/.github/workflows/lambda-repo-security.yml +++ b/.github/workflows/lambda-repo-security.yml @@ -4,19 +4,19 @@ # documentation. # rust-clippy is a tool that runs a bunch of lints to catch common # mistakes in your Rust code and help improve your Rust code. -# More details at https://github.com/rust-lang/rust-clippy +# More details at https://github.com/rust-lang/rust-clippy # and https://rust-lang.github.io/rust-clippy/ name: rust fmt + clippy analyze on: push: - branches: [ "main" ] + branches: ["main"] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ["main"] schedule: - - cron: '41 10 * * 5' + - cron: "41 10 * * 5" jobs: rust-clippy-analyze: @@ -25,7 +25,7 @@ jobs: permissions: contents: read security-events: write - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status steps: - name: Checkout code uses: actions/checkout@v4 @@ -42,7 +42,9 @@ jobs: run: cargo install clippy-sarif sarif-fmt - name: Check formatting - run: cargo fmt --all --check + run: | + rustup component add rustfmt --toolchain nightly-2025-09-26 + cargo +nightly-2025-09-26 fmt --all --check - name: Run rust-clippy run: | diff --git a/crates/lambda-rs-args/examples/basic.rs b/crates/lambda-rs-args/examples/basic.rs index 28b89253..82ab1ace 100644 --- a/crates/lambda-rs-args/examples/basic.rs +++ b/crates/lambda-rs-args/examples/basic.rs @@ -1,9 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, - ArgumentValue, -}; +use args::{Argument, ArgumentParser, ArgumentType, ArgumentValue}; fn main() { let parser = ArgumentParser::new("basic") diff --git a/crates/lambda-rs-args/examples/bools.rs b/crates/lambda-rs-args/examples/bools.rs index ae0b8979..7c0436b6 100644 --- a/crates/lambda-rs-args/examples/bools.rs +++ b/crates/lambda-rs-args/examples/bools.rs @@ -1,8 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{Argument, ArgumentParser, ArgumentType}; fn main() { let parser = ArgumentParser::new("bools") diff --git a/crates/lambda-rs-args/examples/env_config.rs b/crates/lambda-rs-args/examples/env_config.rs index ab9df5f2..bd36fce1 100644 --- a/crates/lambda-rs-args/examples/env_config.rs +++ b/crates/lambda-rs-args/examples/env_config.rs @@ -1,8 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{Argument, ArgumentParser, ArgumentType}; fn main() { // Reads APP_HOST and APP_PORT if set. Also reads from ./app.cfg if present diff --git a/crates/lambda-rs-args/examples/equals.rs b/crates/lambda-rs-args/examples/equals.rs index aba21b71..0b1237ad 100644 --- a/crates/lambda-rs-args/examples/equals.rs +++ b/crates/lambda-rs-args/examples/equals.rs @@ -1,8 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{Argument, ArgumentParser, ArgumentType}; fn main() { let parser = ArgumentParser::new("equals") diff --git a/crates/lambda-rs-args/examples/exclusives.rs b/crates/lambda-rs-args/examples/exclusives.rs index 7dd2b0e6..75cef83f 100644 --- a/crates/lambda-rs-args/examples/exclusives.rs +++ b/crates/lambda-rs-args/examples/exclusives.rs @@ -1,9 +1,4 @@ -use args::{ - ArgsError, - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{ArgsError, Argument, ArgumentParser, ArgumentType}; fn main() { // --json and --yaml are mutually exclusive; --out requires --format diff --git a/crates/lambda-rs-args/examples/positionals.rs b/crates/lambda-rs-args/examples/positionals.rs index e46715a6..ff7ec2e5 100644 --- a/crates/lambda-rs-args/examples/positionals.rs +++ b/crates/lambda-rs-args/examples/positionals.rs @@ -1,8 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{Argument, ArgumentParser, ArgumentType}; fn main() { let parser = ArgumentParser::new("pos") diff --git a/crates/lambda-rs-args/examples/short_count.rs b/crates/lambda-rs-args/examples/short_count.rs index aad62aff..9573cdf4 100644 --- a/crates/lambda-rs-args/examples/short_count.rs +++ b/crates/lambda-rs-args/examples/short_count.rs @@ -1,8 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{Argument, ArgumentParser, ArgumentType}; fn main() { let parser = ArgumentParser::new("short-count").with_argument( diff --git a/crates/lambda-rs-args/examples/subcommands.rs b/crates/lambda-rs-args/examples/subcommands.rs index 4072c54a..16d87801 100644 --- a/crates/lambda-rs-args/examples/subcommands.rs +++ b/crates/lambda-rs-args/examples/subcommands.rs @@ -1,8 +1,4 @@ -use args::{ - Argument, - ArgumentParser, - ArgumentType, -}; +use args::{Argument, ArgumentParser, ArgumentType}; fn main() { // root diff --git a/crates/lambda-rs-args/src/lib.rs b/crates/lambda-rs-args/src/lib.rs index fcd6de44..cb4d06d6 100644 --- a/crates/lambda-rs-args/src/lib.rs +++ b/crates/lambda-rs-args/src/lib.rs @@ -1,12 +1,22 @@ //! # Lambda Args //! Lambda Args is a simple argument parser for Rust. It is designed to be //! simple to use and primarily for use in lambda command line applications. - -use std::{ - collections::HashMap, - fmt, -}; - +#![allow(clippy::needless_return)] + +use std::{collections::HashMap, fmt}; + +/// Configurable command‑line argument parser for Lambda tools and examples. +/// +/// Features: +/// - Long/short flags with aliases (e.g., "-o", "--output") +/// - Positional arguments in declaration order +/// - Type‑aware parsing (`string`, `integer`, `float`, `boolean`, `count`, lists) +/// - Optional environment variable and config‑file integration +/// - Mutually exclusive groups and simple requires relationships +/// - Subcommands with their own parsers +/// +/// Use the builder to register arguments and then call `parse` with a slice of +/// tokens (usually `std::env::args().collect()`). pub struct ArgumentParser { name: String, description: String, @@ -24,20 +34,32 @@ pub struct ArgumentParser { } #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] +/// Supported value types for an argument definition. pub enum ArgumentType { + /// `true`/`false` (or implied by presence when compiled as a flag). Boolean, + /// 64‑bit signed integer. Integer, + /// 32‑bit floating point number. Float, + /// 64‑bit floating point number. Double, + /// UTF‑8 string. String, + /// Count of flag occurrences (e.g., `-vvv` => 3). Count, + /// One or more strings (space‑separated tokens). StringList, + /// One or more integers. IntegerList, + /// One or more 32‑bit floats. FloatList, + /// One or more 64‑bit floats. DoubleList, } #[derive(Debug, Clone, PartialEq, PartialOrd)] +/// Parsed value container used in results and defaults. pub enum ArgumentValue { None, Boolean(bool), @@ -88,6 +110,7 @@ impl Into for ArgumentValue { } #[derive(Debug)] +/// Declarative definition for a single CLI argument or positional parameter. pub struct Argument { name: String, description: String, @@ -99,7 +122,11 @@ pub struct Argument { } impl Argument { - /// Creates a new argument where the name represents + /// Create a new argument definition. + /// + /// The `name` should be the canonical identifier used in help/usage output + /// (for example, `--output` or `--count`). For positional parameters call + /// `as_positional()` when building. pub fn new(name: &str) -> Self { return Argument { name: name.to_string(), @@ -118,13 +145,13 @@ impl Argument { return self; } - /// Sets the type for the ArgumentParser to parse the arguments value into. + /// Sets the type the parser should use when converting the raw value. pub fn with_type(mut self, arg_type: ArgumentType) -> Self { self.arg_type = arg_type; return self; } - /// Sets the description (Help string) of the argument for + /// Set a human‑readable description used in help/usage output. pub fn with_description(mut self, description: &str) -> Self { self.description = description.to_string(); return self; @@ -167,27 +194,33 @@ impl Argument { return self.arg_type.clone(); } + /// Canonical name used for matching and display (e.g., `--output`). pub fn name(&self) -> &str { return self.name.as_ref(); } + /// Default value used when the argument is not present. pub fn default_value(&self) -> ArgumentValue { return self.default_value.clone(); } + /// Description shown in `usage()` output. pub fn description(&self) -> &str { return self.description.as_ref(); } + /// Declared aliases that resolve to this argument (e.g., `-o`). pub fn aliases(&self) -> &Vec { &self.aliases } + /// Whether the argument is positional (no leading `-`/`--`). pub fn is_positional(&self) -> bool { self.positional } } #[derive(Debug, Clone)] +/// A single parsed argument result as `(name, value)`. pub struct ParsedArgument { name: String, value: ArgumentValue, @@ -205,6 +238,7 @@ impl ParsedArgument { return self.name.clone(); } + /// Return a clone of the parsed value. pub fn value(&self) -> ArgumentValue { return self.value.clone(); } @@ -240,17 +274,20 @@ impl ArgumentParser { return self.args.len(); } + /// Add an author string displayed in `usage()`. pub fn with_author(mut self, author: &str) -> Self { self.authors.push(author.to_string()); self } // TODO(vmarcella): Add description to the name + /// Add a human‑readable description shown in `usage()`. pub fn with_description(mut self, description: &str) -> Self { self.description = description.to_string(); self } + /// Register an argument definition with the parser. pub fn with_argument(mut self, argument: Argument) -> Self { let idx = self.args.len(); let name = argument.name().to_string(); @@ -264,7 +301,7 @@ impl ArgumentParser { return self; } - /// Set an environment variable prefix (e.g., "OBJ_LOADER"). + /// Set an environment variable prefix to read defaults (e.g., "OBJ_LOADER"). pub fn with_env_prefix(mut self, prefix: &str) -> Self { self.env_prefix = Some(prefix.to_string()); self @@ -290,13 +327,13 @@ impl ArgumentParser { self } - /// Merge values from a simple key=value config file (optional). + /// Merge values from a simple `key=value` config file (optional). pub fn with_config_file(mut self, path: &str) -> Self { self.config_path = Some(path.to_string()); self } - /// Add a subcommand parser. + /// Add a subcommand parser which activates on a matching first token. pub fn with_subcommand(mut self, mut sub: ArgumentParser) -> Self { sub.is_subcommand = true; let key = sub.name.clone(); @@ -717,7 +754,7 @@ impl ArgumentParser { }) } - /// Backwards-compatible panicking API. Prefer `parse` for non-panicking behavior. + /// Backwards‑compatible panicking API. Prefer `parse` for non‑panicking use. pub fn compile(self, args: &[String]) -> Vec { match self.parse(args) { Ok(parsed) => parsed.into_vec(), @@ -791,16 +828,23 @@ fn parse_value(arg: &Argument, raw: &str) -> Result { } #[derive(Debug)] +/// Errors that may occur during argument parsing. pub enum ArgsError { + /// An unknown flag or option was encountered. UnknownArgument(String), + /// The same flag/option was specified more than once when not allowed. DuplicateArgument(String), + /// A flag/option expecting a value did not receive one. MissingValue(String), + /// A provided value could not be parsed into the expected type. InvalidValue { name: String, expected: String, value: String, }, + /// A required option or positional argument was not provided. MissingRequired(String), + /// Help was requested; contains a preformatted usage string. HelpRequested(String), } @@ -831,7 +875,7 @@ impl fmt::Display for ArgsError { impl std::error::Error for ArgsError {} -/// A parsed arguments wrapper with typed getters. +/// Parsed arguments with typed getters and subcommand support. #[derive(Debug, Clone)] pub struct ParsedArgs { values: Vec, @@ -839,10 +883,12 @@ pub struct ParsedArgs { } impl ParsedArgs { + /// Convert into the raw underlying `(name, value)` vector. pub fn into_vec(self) -> Vec { self.values } + /// True if the named argument is present (and not `None`). pub fn has(&self, name: &str) -> bool { self .values @@ -850,6 +896,7 @@ impl ParsedArgs { .any(|p| p.name == name && !matches!(p.value, ArgumentValue::None)) } + /// Get a `String` value by name, if present and typed as string. pub fn get_string(&self, name: &str) -> Option { self .values @@ -861,6 +908,7 @@ impl ParsedArgs { }) } + /// Get an `i64` value by name, if present and typed as integer. pub fn get_i64(&self, name: &str) -> Option { self .values @@ -872,6 +920,7 @@ impl ParsedArgs { }) } + /// Get an `f32` value by name, if present and typed as float. pub fn get_f32(&self, name: &str) -> Option { self .values @@ -883,6 +932,7 @@ impl ParsedArgs { }) } + /// Get an `f64` value by name, if present and typed as double. pub fn get_f64(&self, name: &str) -> Option { self .values @@ -894,6 +944,7 @@ impl ParsedArgs { }) } + /// Get a `bool` value by name, if present and typed as boolean. pub fn get_bool(&self, name: &str) -> Option { self .values diff --git a/crates/lambda-rs-logging/src/handler.rs b/crates/lambda-rs-logging/src/handler.rs index 4e418b2e..dd0a9a8a 100644 --- a/crates/lambda-rs-logging/src/handler.rs +++ b/crates/lambda-rs-logging/src/handler.rs @@ -1,14 +1,13 @@ //! Log handling implementations for the logger. -use std::{ - fmt::Debug, - fs::OpenOptions, - io::Write, - time::SystemTime, -}; +use std::{fmt::Debug, fs::OpenOptions, io::Write, time::SystemTime}; use crate::LogLevel; +/// Pluggable sink for log records emitted by the `Logger`. +/// +/// Implementors decide how to format and where to deliver messages for each +/// severity level. pub trait Handler { fn trace(&mut self, message: String); fn debug(&mut self, message: String); @@ -102,6 +101,7 @@ impl Handler for FileHandler { } #[derive(Debug, Clone, PartialEq, PartialOrd)] +/// A handler that prints colored log lines to stdout. pub struct ConsoleHandler { name: String, } diff --git a/crates/lambda-rs-logging/src/lib.rs b/crates/lambda-rs-logging/src/lib.rs index 1fbd7cf6..96322af0 100644 --- a/crates/lambda-rs-logging/src/lib.rs +++ b/crates/lambda-rs-logging/src/lib.rs @@ -1,4 +1,5 @@ //! A simple logging library for lambda-rs crates. +#![allow(clippy::needless_return)] use std::fmt::Debug; diff --git a/crates/lambda-rs-platform/src/lib.rs b/crates/lambda-rs-platform/src/lib.rs index 3e7248a5..8725067a 100644 --- a/crates/lambda-rs-platform/src/lib.rs +++ b/crates/lambda-rs-platform/src/lib.rs @@ -1,3 +1,10 @@ +//! Cross‑platform abstractions and utilities used by Lambda. +//! +//! This crate hosts thin wrappers around `winit` (windowing) and `wgpu` +//! (graphics) that provide consistent defaults and ergonomic builders, along +//! with shader compilation backends and small helper modules (e.g., OBJ +//! loading and random number generation). +#![allow(clippy::needless_return)] pub mod obj; pub mod rand; pub mod shader; diff --git a/crates/lambda-rs-platform/src/obj/mod.rs b/crates/lambda-rs-platform/src/obj/mod.rs index 07aec04c..36ad2cc9 100644 --- a/crates/lambda-rs-platform/src/obj/mod.rs +++ b/crates/lambda-rs-platform/src/obj/mod.rs @@ -1,13 +1,10 @@ -use std::{ - fs::File, - io::BufReader, -}; +//! Minimal helpers for loading Wavefront OBJ assets. +//! +//! These functions are thin wrappers around the `obj` crate used by examples +//! and tooling to import meshes. +use std::{fs::File, io::BufReader}; -use obj::{ - load_obj, - Obj, - TexturedVertex, -}; +use obj::{load_obj, Obj, TexturedVertex}; /// Loads a untextured obj file from the given path. Wrapper around the obj crate. pub fn load_obj_from_file(path: &str) -> Obj { diff --git a/crates/lambda-rs-platform/src/rand/mod.rs b/crates/lambda-rs-platform/src/rand/mod.rs index 5e727226..b87c2473 100644 --- a/crates/lambda-rs-platform/src/rand/mod.rs +++ b/crates/lambda-rs-platform/src/rand/mod.rs @@ -1,3 +1,7 @@ +//! Random number utilities used by examples and tests. +//! +//! Functions here delegate to the `rand` crate to generate simple random +//! values and uniformly distributed sequences. use rand::Rng; /// Generate a random float within any given range. diff --git a/crates/lambda-rs-platform/src/shader/mod.rs b/crates/lambda-rs-platform/src/shader/mod.rs index 572fdc68..34ec366a 100644 --- a/crates/lambda-rs-platform/src/shader/mod.rs +++ b/crates/lambda-rs-platform/src/shader/mod.rs @@ -1,10 +1,7 @@ //! Abstractions for compiling shaders into SPIR-V for Lambda runtimes. mod types; -pub use types::{ - ShaderKind, - VirtualShader, -}; +pub use types::{ShaderKind, VirtualShader}; #[cfg(feature = "shader-backend-naga")] mod naga; @@ -13,23 +10,14 @@ mod naga; mod shaderc_backend; #[cfg(feature = "shader-backend-naga")] -pub use naga::{ - ShaderCompiler, - ShaderCompilerBuilder, -}; +pub use naga::{ShaderCompiler, ShaderCompilerBuilder}; #[cfg(all( feature = "shader-backend-naga", feature = "shader-backend-shaderc" ))] -pub use naga::{ - ShaderCompiler, - ShaderCompilerBuilder, -}; +pub use naga::{ShaderCompiler, ShaderCompilerBuilder}; #[cfg(all( not(feature = "shader-backend-naga"), feature = "shader-backend-shaderc" ))] -pub use shaderc_backend::{ - ShaderCompiler, - ShaderCompilerBuilder, -}; +pub use shaderc_backend::{ShaderCompiler, ShaderCompilerBuilder}; diff --git a/crates/lambda-rs-platform/src/shader/naga.rs b/crates/lambda-rs-platform/src/shader/naga.rs index e174da4c..5d78d1d9 100644 --- a/crates/lambda-rs-platform/src/shader/naga.rs +++ b/crates/lambda-rs-platform/src/shader/naga.rs @@ -3,18 +3,11 @@ use std::io::Read; use naga::{ back::spv, front::glsl, - valid::{ - Capabilities, - ValidationFlags, - Validator, - }, + valid::{Capabilities, ValidationFlags, Validator}, ShaderStage, }; -use super::{ - ShaderKind, - VirtualShader, -}; +use super::{ShaderKind, VirtualShader}; /// Builder for the naga-backed shader compiler. pub struct ShaderCompilerBuilder {} diff --git a/crates/lambda-rs-platform/src/shader/shaderc_backend.rs b/crates/lambda-rs-platform/src/shader/shaderc_backend.rs index f92bebce..4ee94fdf 100644 --- a/crates/lambda-rs-platform/src/shader/shaderc_backend.rs +++ b/crates/lambda-rs-platform/src/shader/shaderc_backend.rs @@ -2,10 +2,7 @@ use std::io::Read; use shaderc; -use super::{ - ShaderKind, - VirtualShader, -}; +use super::{ShaderKind, VirtualShader}; /// Builder for the shaderc platform shader compiler. pub struct ShaderCompilerBuilder {} diff --git a/crates/lambda-rs-platform/src/shaderc.rs b/crates/lambda-rs-platform/src/shaderc.rs index f375f999..836dbcb4 100644 --- a/crates/lambda-rs-platform/src/shaderc.rs +++ b/crates/lambda-rs-platform/src/shaderc.rs @@ -5,8 +5,5 @@ note = "Use `lambda_platform::shader` instead of `lambda_platform::shaderc`." )] pub use crate::shader::{ - ShaderCompiler, - ShaderCompilerBuilder, - ShaderKind, - VirtualShader, + ShaderCompiler, ShaderCompilerBuilder, ShaderKind, VirtualShader, }; diff --git a/crates/lambda-rs-platform/src/wgpu/mod.rs b/crates/lambda-rs-platform/src/wgpu/mod.rs index 058f0e80..03701512 100644 --- a/crates/lambda-rs-platform/src/wgpu/mod.rs +++ b/crates/lambda-rs-platform/src/wgpu/mod.rs @@ -8,10 +8,7 @@ use pollster::block_on; pub use wgpu as types; -use wgpu::rwh::{ - HasDisplayHandle as _, - HasWindowHandle as _, -}; +use wgpu::rwh::{HasDisplayHandle as _, HasWindowHandle as _}; use crate::winit::WindowHandle; diff --git a/crates/lambda-rs-platform/src/winit/mod.rs b/crates/lambda-rs-platform/src/winit/mod.rs index 4f39e881..930e9088 100644 --- a/crates/lambda-rs-platform/src/winit/mod.rs +++ b/crates/lambda-rs-platform/src/winit/mod.rs @@ -1,46 +1,25 @@ //! Winit wrapper to easily construct cross platform windows use winit::{ - dpi::{ - LogicalSize, - PhysicalSize, - }, + dpi::{LogicalSize, PhysicalSize}, event::Event, event_loop::{ - ControlFlow, - EventLoop, - EventLoopBuilder, - EventLoopProxy, + ControlFlow, EventLoop, EventLoopBuilder, EventLoopProxy, EventLoopWindowTarget, }, monitor::MonitorHandle, - window::{ - Window, - WindowBuilder, - }, + window::{Window, WindowBuilder}, }; /// Embedded module for exporting data/types from winit as minimally/controlled /// as possible. The exports from this module are not guaranteed to be stable. pub mod winit_exports { pub use winit::{ - event::{ - ElementState, - Event, - KeyEvent, - MouseButton, - WindowEvent, - }, + event::{ElementState, Event, KeyEvent, MouseButton, WindowEvent}, event_loop::{ - ControlFlow, - EventLoop, - EventLoopProxy, - EventLoopWindowTarget, - }, - keyboard::{ - KeyCode, - PhysicalKey, + ControlFlow, EventLoop, EventLoopProxy, EventLoopWindowTarget, }, + keyboard::{KeyCode, PhysicalKey}, }; } @@ -81,6 +60,7 @@ pub struct WindowSize { pub physical: PhysicalSize, } +/// Aggregated window handle with cached sizing and monitor metadata. pub struct WindowHandle { pub window_handle: Window, pub size: WindowSize, @@ -88,6 +68,7 @@ pub struct WindowHandle { } // Should we take the loop as a field right here? Probably a ref or something? IDK +/// Builder for constructing a `WindowHandle` from window properties. pub struct WindowHandleBuilder { window_handle: Option, size: WindowSize, diff --git a/crates/lambda-rs/examples/minimal.rs b/crates/lambda-rs/examples/minimal.rs index 9158c3e3..54faa2dd 100644 --- a/crates/lambda-rs/examples/minimal.rs +++ b/crates/lambda-rs/examples/minimal.rs @@ -4,10 +4,7 @@ //! applications correctly. #[macro_use] -use lambda::{ - runtime::start_runtime, - runtimes::ApplicationRuntimeBuilder, -}; +use lambda::{runtime::start_runtime, runtimes::ApplicationRuntimeBuilder}; fn main() { let runtime = ApplicationRuntimeBuilder::new("Minimal Demo application") @@ -20,3 +17,4 @@ fn main() { start_runtime(runtime); } +#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/examples/push_constants.rs b/crates/lambda-rs/examples/push_constants.rs index 90d06370..703fd186 100644 --- a/crates/lambda-rs/examples/push_constants.rs +++ b/crates/lambda-rs/examples/push_constants.rs @@ -2,43 +2,20 @@ use lambda::{ component::Component, events::WindowEvent, logging, - math::{ - matrix, - matrix::Matrix, - vector::Vector, - }, + math::{matrix, matrix::Matrix, vector::Vector}, render::{ buffer::BufferBuilder, command::RenderCommand, - mesh::{ - Mesh, - MeshBuilder, - }, - pipeline::{ - PipelineStage, - RenderPipelineBuilder, - }, + mesh::{Mesh, MeshBuilder}, + pipeline::{PipelineStage, RenderPipelineBuilder}, render_pass::RenderPassBuilder, - shader::{ - Shader, - ShaderBuilder, - ShaderKind, - VirtualShader, - }, - vertex::{ - VertexAttribute, - VertexBuilder, - VertexElement, - }, - viewport, - ColorFormat, - ResourceId, + shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, + vertex::{VertexAttribute, VertexBuilder, VertexElement}, + viewport, ColorFormat, ResourceId, }, runtime::start_runtime, runtimes::{ - application::ComponentResult, - ApplicationRuntime, - ApplicationRuntimeBuilder, + application::ComponentResult, ApplicationRuntime, ApplicationRuntimeBuilder, }, }; @@ -369,3 +346,4 @@ fn main() { start_runtime(runtime); } +#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/examples/triangle.rs b/crates/lambda-rs/examples/triangle.rs index 43d8a1ce..20e66b8a 100644 --- a/crates/lambda-rs/examples/triangle.rs +++ b/crates/lambda-rs/examples/triangle.rs @@ -1,29 +1,14 @@ use lambda::{ component::Component, - events::{ - ComponentEvent, - Events, - Key, - WindowEvent, - }, + events::{ComponentEvent, Events, Key, WindowEvent}, render::{ command::RenderCommand, - pipeline, - render_pass, - shader::{ - Shader, - ShaderBuilder, - ShaderKind, - VirtualShader, - }, - viewport, - RenderContext, + pipeline, render_pass, + shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, + viewport, RenderContext, }, runtime::start_runtime, - runtimes::{ - application::ComponentResult, - ApplicationRuntimeBuilder, - }, + runtimes::{application::ComponentResult, ApplicationRuntimeBuilder}, }; pub struct DemoComponent { @@ -220,3 +205,4 @@ fn main() { start_runtime(runtime); } +#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/examples/triangles.rs b/crates/lambda-rs/examples/triangles.rs index b8a4548d..73315eec 100644 --- a/crates/lambda-rs/examples/triangles.rs +++ b/crates/lambda-rs/examples/triangles.rs @@ -1,32 +1,15 @@ use lambda::{ component::Component, - events::{ - Events, - Key, - VirtualKey, - WindowEvent, - }, + events::{Events, Key, VirtualKey, WindowEvent}, render::{ command::RenderCommand, - pipeline::{ - self, - PipelineStage, - }, + pipeline::{self, PipelineStage}, render_pass, - shader::{ - Shader, - ShaderBuilder, - ShaderKind, - VirtualShader, - }, - viewport, - RenderContext, + shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, + viewport, RenderContext, }, runtime::start_runtime, - runtimes::{ - application::ComponentResult, - ApplicationRuntimeBuilder, - }, + runtimes::{application::ComponentResult, ApplicationRuntimeBuilder}, }; pub struct TrianglesComponent { @@ -283,3 +266,4 @@ fn main() { start_runtime(runtime); } +#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/src/component.rs b/crates/lambda-rs/src/component.rs index cdd3d1b0..292741d4 100644 --- a/crates/lambda-rs/src/component.rs +++ b/crates/lambda-rs/src/component.rs @@ -1,14 +1,8 @@ -use std::{ - fmt::Debug, - time::Duration, -}; +use std::{fmt::Debug, time::Duration}; use crate::{ events::Events, - render::{ - command::RenderCommand, - RenderContext, - }, + render::{command::RenderCommand, RenderContext}, }; /// The Component Interface for allowing Component based data structures diff --git a/crates/lambda-rs/src/lib.rs b/crates/lambda-rs/src/lib.rs index 43d12c06..108f98d6 100644 --- a/crates/lambda-rs/src/lib.rs +++ b/crates/lambda-rs/src/lib.rs @@ -1,4 +1,5 @@ //! Lambda is a simple, fast, and safe compute engine written in Rust. +#![allow(clippy::needless_return)] pub mod component; pub mod events; diff --git a/crates/lambda-rs/src/math/matrix.rs b/crates/lambda-rs/src/math/matrix.rs index 4bb37eb6..269cfc77 100644 --- a/crates/lambda-rs/src/math/matrix.rs +++ b/crates/lambda-rs/src/math/matrix.rs @@ -2,10 +2,7 @@ use lambda_platform::rand::get_uniformly_random_floats_between; -use super::{ - turns_to_radians, - vector::Vector, -}; +use super::{turns_to_radians, vector::Vector}; // -------------------------------- MATRIX ------------------------------------- @@ -392,16 +389,9 @@ where mod tests { use super::{ - filled_matrix, - perspective_matrix, - rotate_matrix, - submatrix, - Matrix, - }; - use crate::math::{ - matrix::translation_matrix, - turns_to_radians, + filled_matrix, perspective_matrix, rotate_matrix, submatrix, Matrix, }; + use crate::math::{matrix::translation_matrix, turns_to_radians}; #[test] fn square_matrix_add() { diff --git a/crates/lambda-rs/src/math/mod.rs b/crates/lambda-rs/src/math/mod.rs index cfbc1380..17804a1a 100644 --- a/crates/lambda-rs/src/math/mod.rs +++ b/crates/lambda-rs/src/math/mod.rs @@ -3,9 +3,16 @@ pub mod matrix; pub mod vector; +/// Angle units used by conversion helpers and matrix transforms. +/// +/// Prefer `Angle::Turns` for ergonomic quarter/half rotations when building +/// camera and model transforms. One full turn equals `2π` radians. pub enum Angle { + /// Angle expressed in radians. Radians(f32), + /// Angle expressed in degrees. Degrees(f32), + /// Angle expressed in turns, where `1.0` is a full revolution. Turns(f32), } diff --git a/crates/lambda-rs/src/render/buffer.rs b/crates/lambda-rs/src/render/buffer.rs index fc337866..8125d9d9 100644 --- a/crates/lambda-rs/src/render/buffer.rs +++ b/crates/lambda-rs/src/render/buffer.rs @@ -2,16 +2,9 @@ use std::rc::Rc; -use lambda_platform::wgpu::types::{ - self as wgpu, - util::DeviceExt, -}; - -use super::{ - mesh::Mesh, - vertex::Vertex, - RenderContext, -}; +use lambda_platform::wgpu::types::{self as wgpu, util::DeviceExt}; + +use super::{mesh::Mesh, vertex::Vertex, RenderContext}; #[derive(Clone, Copy, Debug)] /// High‑level classification for buffers created by the engine. diff --git a/crates/lambda-rs/src/render/command.rs b/crates/lambda-rs/src/render/command.rs index 823762e4..75d94eb1 100644 --- a/crates/lambda-rs/src/render/command.rs +++ b/crates/lambda-rs/src/render/command.rs @@ -2,10 +2,7 @@ use std::ops::Range; -use super::{ - pipeline::PipelineStage, - viewport::Viewport, -}; +use super::{pipeline::PipelineStage, viewport::Viewport}; /// Commands recorded and executed by the `RenderContext` to produce a frame. #[derive(Debug, Clone)] diff --git a/crates/lambda-rs/src/render/mesh.rs b/crates/lambda-rs/src/render/mesh.rs index d549fb1c..3d15a43d 100644 --- a/crates/lambda-rs/src/render/mesh.rs +++ b/crates/lambda-rs/src/render/mesh.rs @@ -3,11 +3,7 @@ use lambda_platform::obj::load_textured_obj_from_file; use super::{ - vertex::{ - Vertex, - VertexAttribute, - VertexElement, - }, + vertex::{Vertex, VertexAttribute, VertexElement}, ColorFormat, }; diff --git a/crates/lambda-rs/src/render/mod.rs b/crates/lambda-rs/src/render/mod.rs index d67ca12c..6ae93568 100644 --- a/crates/lambda-rs/src/render/mod.rs +++ b/crates/lambda-rs/src/render/mod.rs @@ -15,21 +15,14 @@ pub mod window; use std::iter; use lambda_platform::wgpu::{ - types as wgpu, - Gpu, - GpuBuilder, - Instance, - InstanceBuilder, - Surface, + types as wgpu, Gpu, GpuBuilder, Instance, InstanceBuilder, Surface, SurfaceBuilder, }; use logging; pub use vertex::ColorFormat; use self::{ - command::RenderCommand, - pipeline::RenderPipeline, - render_pass::RenderPass, + command::RenderCommand, pipeline::RenderPipeline, render_pass::RenderPass, }; /// Builder for configuring a `RenderContext` tied to a single window. @@ -120,6 +113,7 @@ pub struct RenderContext { render_pipelines: Vec, } +/// Opaque handle used to refer to resources attached to a `RenderContext`. pub type ResourceId = usize; impl RenderContext { diff --git a/crates/lambda-rs/src/render/pipeline.rs b/crates/lambda-rs/src/render/pipeline.rs index 464c1298..9838453d 100644 --- a/crates/lambda-rs/src/render/pipeline.rs +++ b/crates/lambda-rs/src/render/pipeline.rs @@ -1,20 +1,13 @@ //! Render pipeline builders and definitions for lambda runtimes and //! applications. -use std::{ - borrow::Cow, - ops::Range, - rc::Rc, -}; +use std::{borrow::Cow, ops::Range, rc::Rc}; use lambda_platform::wgpu::types as wgpu; use super::{ - buffer::Buffer, - render_pass::RenderPass, - shader::Shader, - vertex::VertexAttribute, - RenderContext, + buffer::Buffer, render_pass::RenderPass, shader::Shader, + vertex::VertexAttribute, RenderContext, }; #[derive(Debug)] diff --git a/crates/lambda-rs/src/render/shader.rs b/crates/lambda-rs/src/render/shader.rs index 50cfc575..6fce5551 100644 --- a/crates/lambda-rs/src/render/shader.rs +++ b/crates/lambda-rs/src/render/shader.rs @@ -2,10 +2,7 @@ // Expose the platform shader compiler abstraction pub use lambda_platform::shader::{ - ShaderCompiler, - ShaderCompilerBuilder, - ShaderKind, - VirtualShader, + ShaderCompiler, ShaderCompilerBuilder, ShaderKind, VirtualShader, }; /// Reusable compiler for turning virtual shaders into SPIR‑V modules. diff --git a/crates/lambda-rs/src/render/window.rs b/crates/lambda-rs/src/render/window.rs index 9d20ad1e..a2b877cb 100644 --- a/crates/lambda-rs/src/render/window.rs +++ b/crates/lambda-rs/src/render/window.rs @@ -1,10 +1,7 @@ //! Window implementation for rendering applications. use lambda_platform::winit::{ - Loop, - WindowHandle, - WindowHandleBuilder, - WindowProperties, + Loop, WindowHandle, WindowHandleBuilder, WindowProperties, }; use crate::events::Events; @@ -42,6 +39,11 @@ impl WindowBuilder { return self; } + /// Request vertical sync behavior for the swapchain. + /// + /// Note: present mode is ultimately selected when configuring the rendering + /// surface in `RenderContextBuilder`. This flag is reserved to influence + /// that choice and is currently a no‑op. pub fn with_vsync(mut self, vsync: bool) -> Self { return self; } diff --git a/crates/lambda-rs/src/runtimes/application.rs b/crates/lambda-rs/src/runtimes/application.rs index d316afa8..71247c3b 100644 --- a/crates/lambda-rs/src/runtimes/application.rs +++ b/crates/lambda-rs/src/runtimes/application.rs @@ -6,47 +6,40 @@ use std::time::Instant; use lambda_platform::winit::{ winit_exports::{ - ElementState, - Event as WinitEvent, - KeyCode as WinitKeyCode, - KeyEvent as WinitKeyEvent, - MouseButton, - PhysicalKey as WinitPhysicalKey, + ElementState, Event as WinitEvent, KeyCode as WinitKeyCode, + KeyEvent as WinitKeyEvent, MouseButton, PhysicalKey as WinitPhysicalKey, WindowEvent as WinitWindowEvent, }, - Loop, - LoopBuilder, + Loop, LoopBuilder, }; use logging; use crate::{ component::Component, events::{ - Button, - ComponentEvent, - Events, - Key, - Mouse, - RuntimeEvent, - WindowEvent, + Button, ComponentEvent, Events, Key, Mouse, RuntimeEvent, WindowEvent, }, render::{ - window::{ - Window, - WindowBuilder, - }, - RenderContext, - RenderContextBuilder, + window::{Window, WindowBuilder}, + RenderContext, RenderContextBuilder, }, runtime::Runtime, }; #[derive(Clone, Debug)] +/// Result value used by component callbacks executed under +/// `ApplicationRuntime`. +/// +/// Components can return `Success` when work completed as expected or +/// `Failure` to signal a non‑fatal error to the runtime. pub enum ComponentResult { Success, Failure, } +/// Builder for constructing an `ApplicationRuntime` with a window, a +/// configured `RenderContext`, and a stack of components that receive events +/// and render access. pub struct ApplicationRuntimeBuilder { app_name: String, render_context_builder: RenderContextBuilder, @@ -55,6 +48,7 @@ pub struct ApplicationRuntimeBuilder { } impl ApplicationRuntimeBuilder { + /// Create a new builder seeded with sensible defaults. pub fn new(app_name: &str) -> Self { return Self { app_name: app_name.to_string(), diff --git a/crates/lambda-rs/src/runtimes/mod.rs b/crates/lambda-rs/src/runtimes/mod.rs index eb459f59..b041c679 100644 --- a/crates/lambda-rs/src/runtimes/mod.rs +++ b/crates/lambda-rs/src/runtimes/mod.rs @@ -1,5 +1,5 @@ +//! Runtime implementations and builders for Lambda applications. +//!\n//! This module currently exposes the windowed `ApplicationRuntime` which pairs +//! a `RenderContext` with an event loop and a component stack. pub mod application; -pub use application::{ - ApplicationRuntime, - ApplicationRuntimeBuilder, -}; +pub use application::{ApplicationRuntime, ApplicationRuntimeBuilder}; diff --git a/crates/lambda-rs/tests/runnables.rs b/crates/lambda-rs/tests/runnables.rs index 4b3b1ed8..ce9f3328 100644 --- a/crates/lambda-rs/tests/runnables.rs +++ b/crates/lambda-rs/tests/runnables.rs @@ -1,2 +1,3 @@ #[test] fn lambda_runnable() {} +#![allow(clippy::needless_return)] diff --git a/tools/obj_loader/src/main.rs b/tools/obj_loader/src/main.rs index 6801ca74..d0a76abc 100644 --- a/tools/obj_loader/src/main.rs +++ b/tools/obj_loader/src/main.rs @@ -1,55 +1,25 @@ use std::env; use args::{ - Argument, - ArgumentParser, - ArgumentType, - ArgumentValue, - ParsedArgument, + Argument, ArgumentParser, ArgumentType, ArgumentValue, ParsedArgument, }; use lambda::{ component::Component, - events::{ - ComponentEvent, - Events, - WindowEvent, - }, + events::{ComponentEvent, Events, WindowEvent}, logging, - math::matrix::{ - self, - Matrix, - }, + math::matrix::{self, Matrix}, render::{ buffer::BufferBuilder, command::RenderCommand, - mesh::{ - Mesh, - MeshBuilder, - }, - pipeline::{ - PipelineStage, - RenderPipelineBuilder, - }, + mesh::{Mesh, MeshBuilder}, + pipeline::{PipelineStage, RenderPipelineBuilder}, render_pass::RenderPassBuilder, - shader::{ - Shader, - ShaderBuilder, - ShaderKind, - VirtualShader, - }, - vertex::{ - Vertex, - VertexAttribute, - VertexElement, - }, - viewport, - ResourceId, + shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, + vertex::{Vertex, VertexAttribute, VertexElement}, + viewport, ResourceId, }, runtime::start_runtime, - runtimes::{ - application::ComponentResult, - ApplicationRuntimeBuilder, - }, + runtimes::{application::ComponentResult, ApplicationRuntimeBuilder}, }; // ------------------------------ SHADER SOURCE -------------------------------- From 83fb9d881f4cbe7ed76e946631b45203d29e68e1 Mon Sep 17 00:00:00 2001 From: vmarcella Date: Sun, 28 Sep 2025 01:17:54 -0700 Subject: [PATCH 2/3] [fix] formatting and warnings. --- crates/lambda-rs-args/examples/basic.rs | 7 ++- crates/lambda-rs-args/examples/bools.rs | 6 ++- crates/lambda-rs-args/examples/env_config.rs | 6 ++- crates/lambda-rs-args/examples/equals.rs | 6 ++- crates/lambda-rs-args/examples/exclusives.rs | 7 ++- crates/lambda-rs-args/examples/positionals.rs | 6 ++- crates/lambda-rs-args/examples/short_count.rs | 6 ++- crates/lambda-rs-args/examples/subcommands.rs | 6 ++- crates/lambda-rs-args/src/lib.rs | 7 ++- crates/lambda-rs-logging/src/handler.rs | 7 ++- crates/lambda-rs-logging/src/lib.rs | 2 +- crates/lambda-rs-platform/src/lib.rs | 2 +- crates/lambda-rs-platform/src/obj/mod.rs | 11 ++++- crates/lambda-rs-platform/src/shader/mod.rs | 20 ++++++-- crates/lambda-rs-platform/src/shader/naga.rs | 11 ++++- .../src/shader/shaderc_backend.rs | 5 +- crates/lambda-rs-platform/src/shaderc.rs | 5 +- crates/lambda-rs-platform/src/wgpu/mod.rs | 5 +- crates/lambda-rs-platform/src/winit/mod.rs | 33 ++++++++++--- crates/lambda-rs/examples/minimal.rs | 7 ++- crates/lambda-rs/examples/push_constants.rs | 40 ++++++++++++---- crates/lambda-rs/examples/triangle.rs | 27 ++++++++--- crates/lambda-rs/examples/triangles.rs | 29 ++++++++--- crates/lambda-rs/src/component.rs | 10 +++- crates/lambda-rs/src/lib.rs | 2 +- crates/lambda-rs/src/math/matrix.rs | 16 +++++-- crates/lambda-rs/src/render/buffer.rs | 13 +++-- crates/lambda-rs/src/render/command.rs | 5 +- crates/lambda-rs/src/render/mesh.rs | 6 ++- crates/lambda-rs/src/render/mod.rs | 11 ++++- crates/lambda-rs/src/render/pipeline.rs | 13 +++-- crates/lambda-rs/src/render/shader.rs | 5 +- crates/lambda-rs/src/render/window.rs | 5 +- crates/lambda-rs/src/runtimes/application.rs | 27 ++++++++--- crates/lambda-rs/src/runtimes/mod.rs | 5 +- crates/lambda-rs/tests/runnables.rs | 2 +- rustfmt.toml | 2 +- tools/obj_loader/src/main.rs | 48 +++++++++++++++---- 38 files changed, 343 insertions(+), 88 deletions(-) diff --git a/crates/lambda-rs-args/examples/basic.rs b/crates/lambda-rs-args/examples/basic.rs index 82ab1ace..28b89253 100644 --- a/crates/lambda-rs-args/examples/basic.rs +++ b/crates/lambda-rs-args/examples/basic.rs @@ -1,4 +1,9 @@ -use args::{Argument, ArgumentParser, ArgumentType, ArgumentValue}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, + ArgumentValue, +}; fn main() { let parser = ArgumentParser::new("basic") diff --git a/crates/lambda-rs-args/examples/bools.rs b/crates/lambda-rs-args/examples/bools.rs index 7c0436b6..ae0b8979 100644 --- a/crates/lambda-rs-args/examples/bools.rs +++ b/crates/lambda-rs-args/examples/bools.rs @@ -1,4 +1,8 @@ -use args::{Argument, ArgumentParser, ArgumentType}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { let parser = ArgumentParser::new("bools") diff --git a/crates/lambda-rs-args/examples/env_config.rs b/crates/lambda-rs-args/examples/env_config.rs index bd36fce1..ab9df5f2 100644 --- a/crates/lambda-rs-args/examples/env_config.rs +++ b/crates/lambda-rs-args/examples/env_config.rs @@ -1,4 +1,8 @@ -use args::{Argument, ArgumentParser, ArgumentType}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { // Reads APP_HOST and APP_PORT if set. Also reads from ./app.cfg if present diff --git a/crates/lambda-rs-args/examples/equals.rs b/crates/lambda-rs-args/examples/equals.rs index 0b1237ad..aba21b71 100644 --- a/crates/lambda-rs-args/examples/equals.rs +++ b/crates/lambda-rs-args/examples/equals.rs @@ -1,4 +1,8 @@ -use args::{Argument, ArgumentParser, ArgumentType}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { let parser = ArgumentParser::new("equals") diff --git a/crates/lambda-rs-args/examples/exclusives.rs b/crates/lambda-rs-args/examples/exclusives.rs index 75cef83f..7dd2b0e6 100644 --- a/crates/lambda-rs-args/examples/exclusives.rs +++ b/crates/lambda-rs-args/examples/exclusives.rs @@ -1,4 +1,9 @@ -use args::{ArgsError, Argument, ArgumentParser, ArgumentType}; +use args::{ + ArgsError, + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { // --json and --yaml are mutually exclusive; --out requires --format diff --git a/crates/lambda-rs-args/examples/positionals.rs b/crates/lambda-rs-args/examples/positionals.rs index ff7ec2e5..e46715a6 100644 --- a/crates/lambda-rs-args/examples/positionals.rs +++ b/crates/lambda-rs-args/examples/positionals.rs @@ -1,4 +1,8 @@ -use args::{Argument, ArgumentParser, ArgumentType}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { let parser = ArgumentParser::new("pos") diff --git a/crates/lambda-rs-args/examples/short_count.rs b/crates/lambda-rs-args/examples/short_count.rs index 9573cdf4..aad62aff 100644 --- a/crates/lambda-rs-args/examples/short_count.rs +++ b/crates/lambda-rs-args/examples/short_count.rs @@ -1,4 +1,8 @@ -use args::{Argument, ArgumentParser, ArgumentType}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { let parser = ArgumentParser::new("short-count").with_argument( diff --git a/crates/lambda-rs-args/examples/subcommands.rs b/crates/lambda-rs-args/examples/subcommands.rs index 16d87801..4072c54a 100644 --- a/crates/lambda-rs-args/examples/subcommands.rs +++ b/crates/lambda-rs-args/examples/subcommands.rs @@ -1,4 +1,8 @@ -use args::{Argument, ArgumentParser, ArgumentType}; +use args::{ + Argument, + ArgumentParser, + ArgumentType, +}; fn main() { // root diff --git a/crates/lambda-rs-args/src/lib.rs b/crates/lambda-rs-args/src/lib.rs index cb4d06d6..31cf4e13 100644 --- a/crates/lambda-rs-args/src/lib.rs +++ b/crates/lambda-rs-args/src/lib.rs @@ -1,9 +1,12 @@ +#![allow(clippy::needless_return)] //! # Lambda Args //! Lambda Args is a simple argument parser for Rust. It is designed to be //! simple to use and primarily for use in lambda command line applications. -#![allow(clippy::needless_return)] -use std::{collections::HashMap, fmt}; +use std::{ + collections::HashMap, + fmt, +}; /// Configurable command‑line argument parser for Lambda tools and examples. /// diff --git a/crates/lambda-rs-logging/src/handler.rs b/crates/lambda-rs-logging/src/handler.rs index dd0a9a8a..f2a5d5c7 100644 --- a/crates/lambda-rs-logging/src/handler.rs +++ b/crates/lambda-rs-logging/src/handler.rs @@ -1,6 +1,11 @@ //! Log handling implementations for the logger. -use std::{fmt::Debug, fs::OpenOptions, io::Write, time::SystemTime}; +use std::{ + fmt::Debug, + fs::OpenOptions, + io::Write, + time::SystemTime, +}; use crate::LogLevel; diff --git a/crates/lambda-rs-logging/src/lib.rs b/crates/lambda-rs-logging/src/lib.rs index 96322af0..a2e97582 100644 --- a/crates/lambda-rs-logging/src/lib.rs +++ b/crates/lambda-rs-logging/src/lib.rs @@ -1,5 +1,5 @@ -//! A simple logging library for lambda-rs crates. #![allow(clippy::needless_return)] +//! A simple logging library for lambda-rs crates. use std::fmt::Debug; diff --git a/crates/lambda-rs-platform/src/lib.rs b/crates/lambda-rs-platform/src/lib.rs index 8725067a..2e4ca19c 100644 --- a/crates/lambda-rs-platform/src/lib.rs +++ b/crates/lambda-rs-platform/src/lib.rs @@ -1,10 +1,10 @@ +#![allow(clippy::needless_return)] //! Cross‑platform abstractions and utilities used by Lambda. //! //! This crate hosts thin wrappers around `winit` (windowing) and `wgpu` //! (graphics) that provide consistent defaults and ergonomic builders, along //! with shader compilation backends and small helper modules (e.g., OBJ //! loading and random number generation). -#![allow(clippy::needless_return)] pub mod obj; pub mod rand; pub mod shader; diff --git a/crates/lambda-rs-platform/src/obj/mod.rs b/crates/lambda-rs-platform/src/obj/mod.rs index 36ad2cc9..2114463d 100644 --- a/crates/lambda-rs-platform/src/obj/mod.rs +++ b/crates/lambda-rs-platform/src/obj/mod.rs @@ -2,9 +2,16 @@ //! //! These functions are thin wrappers around the `obj` crate used by examples //! and tooling to import meshes. -use std::{fs::File, io::BufReader}; +use std::{ + fs::File, + io::BufReader, +}; -use obj::{load_obj, Obj, TexturedVertex}; +use obj::{ + load_obj, + Obj, + TexturedVertex, +}; /// Loads a untextured obj file from the given path. Wrapper around the obj crate. pub fn load_obj_from_file(path: &str) -> Obj { diff --git a/crates/lambda-rs-platform/src/shader/mod.rs b/crates/lambda-rs-platform/src/shader/mod.rs index 34ec366a..572fdc68 100644 --- a/crates/lambda-rs-platform/src/shader/mod.rs +++ b/crates/lambda-rs-platform/src/shader/mod.rs @@ -1,7 +1,10 @@ //! Abstractions for compiling shaders into SPIR-V for Lambda runtimes. mod types; -pub use types::{ShaderKind, VirtualShader}; +pub use types::{ + ShaderKind, + VirtualShader, +}; #[cfg(feature = "shader-backend-naga")] mod naga; @@ -10,14 +13,23 @@ mod naga; mod shaderc_backend; #[cfg(feature = "shader-backend-naga")] -pub use naga::{ShaderCompiler, ShaderCompilerBuilder}; +pub use naga::{ + ShaderCompiler, + ShaderCompilerBuilder, +}; #[cfg(all( feature = "shader-backend-naga", feature = "shader-backend-shaderc" ))] -pub use naga::{ShaderCompiler, ShaderCompilerBuilder}; +pub use naga::{ + ShaderCompiler, + ShaderCompilerBuilder, +}; #[cfg(all( not(feature = "shader-backend-naga"), feature = "shader-backend-shaderc" ))] -pub use shaderc_backend::{ShaderCompiler, ShaderCompilerBuilder}; +pub use shaderc_backend::{ + ShaderCompiler, + ShaderCompilerBuilder, +}; diff --git a/crates/lambda-rs-platform/src/shader/naga.rs b/crates/lambda-rs-platform/src/shader/naga.rs index 5d78d1d9..e174da4c 100644 --- a/crates/lambda-rs-platform/src/shader/naga.rs +++ b/crates/lambda-rs-platform/src/shader/naga.rs @@ -3,11 +3,18 @@ use std::io::Read; use naga::{ back::spv, front::glsl, - valid::{Capabilities, ValidationFlags, Validator}, + valid::{ + Capabilities, + ValidationFlags, + Validator, + }, ShaderStage, }; -use super::{ShaderKind, VirtualShader}; +use super::{ + ShaderKind, + VirtualShader, +}; /// Builder for the naga-backed shader compiler. pub struct ShaderCompilerBuilder {} diff --git a/crates/lambda-rs-platform/src/shader/shaderc_backend.rs b/crates/lambda-rs-platform/src/shader/shaderc_backend.rs index 4ee94fdf..f92bebce 100644 --- a/crates/lambda-rs-platform/src/shader/shaderc_backend.rs +++ b/crates/lambda-rs-platform/src/shader/shaderc_backend.rs @@ -2,7 +2,10 @@ use std::io::Read; use shaderc; -use super::{ShaderKind, VirtualShader}; +use super::{ + ShaderKind, + VirtualShader, +}; /// Builder for the shaderc platform shader compiler. pub struct ShaderCompilerBuilder {} diff --git a/crates/lambda-rs-platform/src/shaderc.rs b/crates/lambda-rs-platform/src/shaderc.rs index 836dbcb4..f375f999 100644 --- a/crates/lambda-rs-platform/src/shaderc.rs +++ b/crates/lambda-rs-platform/src/shaderc.rs @@ -5,5 +5,8 @@ note = "Use `lambda_platform::shader` instead of `lambda_platform::shaderc`." )] pub use crate::shader::{ - ShaderCompiler, ShaderCompilerBuilder, ShaderKind, VirtualShader, + ShaderCompiler, + ShaderCompilerBuilder, + ShaderKind, + VirtualShader, }; diff --git a/crates/lambda-rs-platform/src/wgpu/mod.rs b/crates/lambda-rs-platform/src/wgpu/mod.rs index 03701512..058f0e80 100644 --- a/crates/lambda-rs-platform/src/wgpu/mod.rs +++ b/crates/lambda-rs-platform/src/wgpu/mod.rs @@ -8,7 +8,10 @@ use pollster::block_on; pub use wgpu as types; -use wgpu::rwh::{HasDisplayHandle as _, HasWindowHandle as _}; +use wgpu::rwh::{ + HasDisplayHandle as _, + HasWindowHandle as _, +}; use crate::winit::WindowHandle; diff --git a/crates/lambda-rs-platform/src/winit/mod.rs b/crates/lambda-rs-platform/src/winit/mod.rs index 930e9088..853eeb57 100644 --- a/crates/lambda-rs-platform/src/winit/mod.rs +++ b/crates/lambda-rs-platform/src/winit/mod.rs @@ -1,25 +1,46 @@ //! Winit wrapper to easily construct cross platform windows use winit::{ - dpi::{LogicalSize, PhysicalSize}, + dpi::{ + LogicalSize, + PhysicalSize, + }, event::Event, event_loop::{ - ControlFlow, EventLoop, EventLoopBuilder, EventLoopProxy, + ControlFlow, + EventLoop, + EventLoopBuilder, + EventLoopProxy, EventLoopWindowTarget, }, monitor::MonitorHandle, - window::{Window, WindowBuilder}, + window::{ + Window, + WindowBuilder, + }, }; /// Embedded module for exporting data/types from winit as minimally/controlled /// as possible. The exports from this module are not guaranteed to be stable. pub mod winit_exports { pub use winit::{ - event::{ElementState, Event, KeyEvent, MouseButton, WindowEvent}, + event::{ + ElementState, + Event, + KeyEvent, + MouseButton, + WindowEvent, + }, event_loop::{ - ControlFlow, EventLoop, EventLoopProxy, EventLoopWindowTarget, + ControlFlow, + EventLoop, + EventLoopProxy, + EventLoopWindowTarget, + }, + keyboard::{ + KeyCode, + PhysicalKey, }, - keyboard::{KeyCode, PhysicalKey}, }; } diff --git a/crates/lambda-rs/examples/minimal.rs b/crates/lambda-rs/examples/minimal.rs index 54faa2dd..43413baa 100644 --- a/crates/lambda-rs/examples/minimal.rs +++ b/crates/lambda-rs/examples/minimal.rs @@ -1,10 +1,14 @@ +#![allow(clippy::needless_return)] //! Minimal application which configures a window & render context before //! starting the runtime. You can use this as a starting point for your own //! applications or to verify that your system is configured to run lambda //! applications correctly. #[macro_use] -use lambda::{runtime::start_runtime, runtimes::ApplicationRuntimeBuilder}; +use lambda::{ + runtime::start_runtime, + runtimes::ApplicationRuntimeBuilder, +}; fn main() { let runtime = ApplicationRuntimeBuilder::new("Minimal Demo application") @@ -17,4 +21,3 @@ fn main() { start_runtime(runtime); } -#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/examples/push_constants.rs b/crates/lambda-rs/examples/push_constants.rs index 703fd186..4d5014be 100644 --- a/crates/lambda-rs/examples/push_constants.rs +++ b/crates/lambda-rs/examples/push_constants.rs @@ -1,21 +1,46 @@ +#![allow(clippy::needless_return)] + use lambda::{ component::Component, events::WindowEvent, logging, - math::{matrix, matrix::Matrix, vector::Vector}, + math::{ + matrix, + matrix::Matrix, + vector::Vector, + }, render::{ buffer::BufferBuilder, command::RenderCommand, - mesh::{Mesh, MeshBuilder}, - pipeline::{PipelineStage, RenderPipelineBuilder}, + mesh::{ + Mesh, + MeshBuilder, + }, + pipeline::{ + PipelineStage, + RenderPipelineBuilder, + }, render_pass::RenderPassBuilder, - shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, - vertex::{VertexAttribute, VertexBuilder, VertexElement}, - viewport, ColorFormat, ResourceId, + shader::{ + Shader, + ShaderBuilder, + ShaderKind, + VirtualShader, + }, + vertex::{ + VertexAttribute, + VertexBuilder, + VertexElement, + }, + viewport, + ColorFormat, + ResourceId, }, runtime::start_runtime, runtimes::{ - application::ComponentResult, ApplicationRuntime, ApplicationRuntimeBuilder, + application::ComponentResult, + ApplicationRuntime, + ApplicationRuntimeBuilder, }, }; @@ -346,4 +371,3 @@ fn main() { start_runtime(runtime); } -#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/examples/triangle.rs b/crates/lambda-rs/examples/triangle.rs index 20e66b8a..2ee9aa59 100644 --- a/crates/lambda-rs/examples/triangle.rs +++ b/crates/lambda-rs/examples/triangle.rs @@ -1,14 +1,30 @@ +#![allow(clippy::needless_return)] use lambda::{ component::Component, - events::{ComponentEvent, Events, Key, WindowEvent}, + events::{ + ComponentEvent, + Events, + Key, + WindowEvent, + }, render::{ command::RenderCommand, - pipeline, render_pass, - shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, - viewport, RenderContext, + pipeline, + render_pass, + shader::{ + Shader, + ShaderBuilder, + ShaderKind, + VirtualShader, + }, + viewport, + RenderContext, }, runtime::start_runtime, - runtimes::{application::ComponentResult, ApplicationRuntimeBuilder}, + runtimes::{ + application::ComponentResult, + ApplicationRuntimeBuilder, + }, }; pub struct DemoComponent { @@ -205,4 +221,3 @@ fn main() { start_runtime(runtime); } -#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/examples/triangles.rs b/crates/lambda-rs/examples/triangles.rs index 73315eec..9815e012 100644 --- a/crates/lambda-rs/examples/triangles.rs +++ b/crates/lambda-rs/examples/triangles.rs @@ -1,15 +1,33 @@ +#![allow(clippy::needless_return)] use lambda::{ component::Component, - events::{Events, Key, VirtualKey, WindowEvent}, + events::{ + Events, + Key, + VirtualKey, + WindowEvent, + }, render::{ command::RenderCommand, - pipeline::{self, PipelineStage}, + pipeline::{ + self, + PipelineStage, + }, render_pass, - shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, - viewport, RenderContext, + shader::{ + Shader, + ShaderBuilder, + ShaderKind, + VirtualShader, + }, + viewport, + RenderContext, }, runtime::start_runtime, - runtimes::{application::ComponentResult, ApplicationRuntimeBuilder}, + runtimes::{ + application::ComponentResult, + ApplicationRuntimeBuilder, + }, }; pub struct TrianglesComponent { @@ -266,4 +284,3 @@ fn main() { start_runtime(runtime); } -#![allow(clippy::needless_return)] diff --git a/crates/lambda-rs/src/component.rs b/crates/lambda-rs/src/component.rs index 292741d4..cdd3d1b0 100644 --- a/crates/lambda-rs/src/component.rs +++ b/crates/lambda-rs/src/component.rs @@ -1,8 +1,14 @@ -use std::{fmt::Debug, time::Duration}; +use std::{ + fmt::Debug, + time::Duration, +}; use crate::{ events::Events, - render::{command::RenderCommand, RenderContext}, + render::{ + command::RenderCommand, + RenderContext, + }, }; /// The Component Interface for allowing Component based data structures diff --git a/crates/lambda-rs/src/lib.rs b/crates/lambda-rs/src/lib.rs index 108f98d6..b3a9b2b2 100644 --- a/crates/lambda-rs/src/lib.rs +++ b/crates/lambda-rs/src/lib.rs @@ -1,5 +1,5 @@ -//! Lambda is a simple, fast, and safe compute engine written in Rust. #![allow(clippy::needless_return)] +//! Lambda is a simple, fast, and safe compute engine written in Rust. pub mod component; pub mod events; diff --git a/crates/lambda-rs/src/math/matrix.rs b/crates/lambda-rs/src/math/matrix.rs index 269cfc77..4bb37eb6 100644 --- a/crates/lambda-rs/src/math/matrix.rs +++ b/crates/lambda-rs/src/math/matrix.rs @@ -2,7 +2,10 @@ use lambda_platform::rand::get_uniformly_random_floats_between; -use super::{turns_to_radians, vector::Vector}; +use super::{ + turns_to_radians, + vector::Vector, +}; // -------------------------------- MATRIX ------------------------------------- @@ -389,9 +392,16 @@ where mod tests { use super::{ - filled_matrix, perspective_matrix, rotate_matrix, submatrix, Matrix, + filled_matrix, + perspective_matrix, + rotate_matrix, + submatrix, + Matrix, + }; + use crate::math::{ + matrix::translation_matrix, + turns_to_radians, }; - use crate::math::{matrix::translation_matrix, turns_to_radians}; #[test] fn square_matrix_add() { diff --git a/crates/lambda-rs/src/render/buffer.rs b/crates/lambda-rs/src/render/buffer.rs index 8125d9d9..fc337866 100644 --- a/crates/lambda-rs/src/render/buffer.rs +++ b/crates/lambda-rs/src/render/buffer.rs @@ -2,9 +2,16 @@ use std::rc::Rc; -use lambda_platform::wgpu::types::{self as wgpu, util::DeviceExt}; - -use super::{mesh::Mesh, vertex::Vertex, RenderContext}; +use lambda_platform::wgpu::types::{ + self as wgpu, + util::DeviceExt, +}; + +use super::{ + mesh::Mesh, + vertex::Vertex, + RenderContext, +}; #[derive(Clone, Copy, Debug)] /// High‑level classification for buffers created by the engine. diff --git a/crates/lambda-rs/src/render/command.rs b/crates/lambda-rs/src/render/command.rs index 75d94eb1..823762e4 100644 --- a/crates/lambda-rs/src/render/command.rs +++ b/crates/lambda-rs/src/render/command.rs @@ -2,7 +2,10 @@ use std::ops::Range; -use super::{pipeline::PipelineStage, viewport::Viewport}; +use super::{ + pipeline::PipelineStage, + viewport::Viewport, +}; /// Commands recorded and executed by the `RenderContext` to produce a frame. #[derive(Debug, Clone)] diff --git a/crates/lambda-rs/src/render/mesh.rs b/crates/lambda-rs/src/render/mesh.rs index 3d15a43d..d549fb1c 100644 --- a/crates/lambda-rs/src/render/mesh.rs +++ b/crates/lambda-rs/src/render/mesh.rs @@ -3,7 +3,11 @@ use lambda_platform::obj::load_textured_obj_from_file; use super::{ - vertex::{Vertex, VertexAttribute, VertexElement}, + vertex::{ + Vertex, + VertexAttribute, + VertexElement, + }, ColorFormat, }; diff --git a/crates/lambda-rs/src/render/mod.rs b/crates/lambda-rs/src/render/mod.rs index 6ae93568..735db8e7 100644 --- a/crates/lambda-rs/src/render/mod.rs +++ b/crates/lambda-rs/src/render/mod.rs @@ -15,14 +15,21 @@ pub mod window; use std::iter; use lambda_platform::wgpu::{ - types as wgpu, Gpu, GpuBuilder, Instance, InstanceBuilder, Surface, + types as wgpu, + Gpu, + GpuBuilder, + Instance, + InstanceBuilder, + Surface, SurfaceBuilder, }; use logging; pub use vertex::ColorFormat; use self::{ - command::RenderCommand, pipeline::RenderPipeline, render_pass::RenderPass, + command::RenderCommand, + pipeline::RenderPipeline, + render_pass::RenderPass, }; /// Builder for configuring a `RenderContext` tied to a single window. diff --git a/crates/lambda-rs/src/render/pipeline.rs b/crates/lambda-rs/src/render/pipeline.rs index 9838453d..464c1298 100644 --- a/crates/lambda-rs/src/render/pipeline.rs +++ b/crates/lambda-rs/src/render/pipeline.rs @@ -1,13 +1,20 @@ //! Render pipeline builders and definitions for lambda runtimes and //! applications. -use std::{borrow::Cow, ops::Range, rc::Rc}; +use std::{ + borrow::Cow, + ops::Range, + rc::Rc, +}; use lambda_platform::wgpu::types as wgpu; use super::{ - buffer::Buffer, render_pass::RenderPass, shader::Shader, - vertex::VertexAttribute, RenderContext, + buffer::Buffer, + render_pass::RenderPass, + shader::Shader, + vertex::VertexAttribute, + RenderContext, }; #[derive(Debug)] diff --git a/crates/lambda-rs/src/render/shader.rs b/crates/lambda-rs/src/render/shader.rs index 6fce5551..50cfc575 100644 --- a/crates/lambda-rs/src/render/shader.rs +++ b/crates/lambda-rs/src/render/shader.rs @@ -2,7 +2,10 @@ // Expose the platform shader compiler abstraction pub use lambda_platform::shader::{ - ShaderCompiler, ShaderCompilerBuilder, ShaderKind, VirtualShader, + ShaderCompiler, + ShaderCompilerBuilder, + ShaderKind, + VirtualShader, }; /// Reusable compiler for turning virtual shaders into SPIR‑V modules. diff --git a/crates/lambda-rs/src/render/window.rs b/crates/lambda-rs/src/render/window.rs index a2b877cb..ee5567a8 100644 --- a/crates/lambda-rs/src/render/window.rs +++ b/crates/lambda-rs/src/render/window.rs @@ -1,7 +1,10 @@ //! Window implementation for rendering applications. use lambda_platform::winit::{ - Loop, WindowHandle, WindowHandleBuilder, WindowProperties, + Loop, + WindowHandle, + WindowHandleBuilder, + WindowProperties, }; use crate::events::Events; diff --git a/crates/lambda-rs/src/runtimes/application.rs b/crates/lambda-rs/src/runtimes/application.rs index 71247c3b..4cf2b51d 100644 --- a/crates/lambda-rs/src/runtimes/application.rs +++ b/crates/lambda-rs/src/runtimes/application.rs @@ -6,22 +6,37 @@ use std::time::Instant; use lambda_platform::winit::{ winit_exports::{ - ElementState, Event as WinitEvent, KeyCode as WinitKeyCode, - KeyEvent as WinitKeyEvent, MouseButton, PhysicalKey as WinitPhysicalKey, + ElementState, + Event as WinitEvent, + KeyCode as WinitKeyCode, + KeyEvent as WinitKeyEvent, + MouseButton, + PhysicalKey as WinitPhysicalKey, WindowEvent as WinitWindowEvent, }, - Loop, LoopBuilder, + Loop, + LoopBuilder, }; use logging; use crate::{ component::Component, events::{ - Button, ComponentEvent, Events, Key, Mouse, RuntimeEvent, WindowEvent, + Button, + ComponentEvent, + Events, + Key, + Mouse, + RuntimeEvent, + WindowEvent, }, render::{ - window::{Window, WindowBuilder}, - RenderContext, RenderContextBuilder, + window::{ + Window, + WindowBuilder, + }, + RenderContext, + RenderContextBuilder, }, runtime::Runtime, }; diff --git a/crates/lambda-rs/src/runtimes/mod.rs b/crates/lambda-rs/src/runtimes/mod.rs index b041c679..4968d88b 100644 --- a/crates/lambda-rs/src/runtimes/mod.rs +++ b/crates/lambda-rs/src/runtimes/mod.rs @@ -2,4 +2,7 @@ //!\n//! This module currently exposes the windowed `ApplicationRuntime` which pairs //! a `RenderContext` with an event loop and a component stack. pub mod application; -pub use application::{ApplicationRuntime, ApplicationRuntimeBuilder}; +pub use application::{ + ApplicationRuntime, + ApplicationRuntimeBuilder, +}; diff --git a/crates/lambda-rs/tests/runnables.rs b/crates/lambda-rs/tests/runnables.rs index ce9f3328..fc4bb623 100644 --- a/crates/lambda-rs/tests/runnables.rs +++ b/crates/lambda-rs/tests/runnables.rs @@ -1,3 +1,3 @@ +#![allow(clippy::needless_return)] #[test] fn lambda_runnable() {} -#![allow(clippy::needless_return)] diff --git a/rustfmt.toml b/rustfmt.toml index e330908f..77fd6f98 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,5 @@ edition="2021" -fn_args_layout="Tall" +fn_params_layout="Tall" force_explicit_abi=true max_width=80 tab_spaces=2 diff --git a/tools/obj_loader/src/main.rs b/tools/obj_loader/src/main.rs index d0a76abc..6801ca74 100644 --- a/tools/obj_loader/src/main.rs +++ b/tools/obj_loader/src/main.rs @@ -1,25 +1,55 @@ use std::env; use args::{ - Argument, ArgumentParser, ArgumentType, ArgumentValue, ParsedArgument, + Argument, + ArgumentParser, + ArgumentType, + ArgumentValue, + ParsedArgument, }; use lambda::{ component::Component, - events::{ComponentEvent, Events, WindowEvent}, + events::{ + ComponentEvent, + Events, + WindowEvent, + }, logging, - math::matrix::{self, Matrix}, + math::matrix::{ + self, + Matrix, + }, render::{ buffer::BufferBuilder, command::RenderCommand, - mesh::{Mesh, MeshBuilder}, - pipeline::{PipelineStage, RenderPipelineBuilder}, + mesh::{ + Mesh, + MeshBuilder, + }, + pipeline::{ + PipelineStage, + RenderPipelineBuilder, + }, render_pass::RenderPassBuilder, - shader::{Shader, ShaderBuilder, ShaderKind, VirtualShader}, - vertex::{Vertex, VertexAttribute, VertexElement}, - viewport, ResourceId, + shader::{ + Shader, + ShaderBuilder, + ShaderKind, + VirtualShader, + }, + vertex::{ + Vertex, + VertexAttribute, + VertexElement, + }, + viewport, + ResourceId, }, runtime::start_runtime, - runtimes::{application::ComponentResult, ApplicationRuntimeBuilder}, + runtimes::{ + application::ComponentResult, + ApplicationRuntimeBuilder, + }, }; // ------------------------------ SHADER SOURCE -------------------------------- From f09e6d24be9d298a14cbb8b170e359546544a1db Mon Sep 17 00:00:00 2001 From: vmarcella Date: Sun, 28 Sep 2025 13:34:51 -0700 Subject: [PATCH 3/3] [add] fn_args_layout back, as rust-analyzer doesn't seem to work without it. --- rustfmt.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/rustfmt.toml b/rustfmt.toml index 77fd6f98..24e4d6e9 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,5 +1,6 @@ edition="2021" fn_params_layout="Tall" +fn_args_layout = "Tall" force_explicit_abi=true max_width=80 tab_spaces=2