refactor: address clippy warnings and improve code quality (#409)

- Fix string formatting with modern interpolation syntax
- Improve Debug implementation with finish_non_exhaustive()
- Fix function placement in shape.rs to avoid items_after_statements warning
- Use more idiomatic Rust patterns (map_or_else, next_back)
- Clean up conditional imports in vi.rs
- Convert multiple methods to `const` functions for optimization and consistency
- Introduce `core_maths` for enhanced no-std compatibility
- Update `Cargo.toml` for the new optional dependency and feature adjustments
This commit is contained in:
romanstingler 2025-08-11 21:58:59 +02:00 committed by GitHub
parent e80dbc3607
commit a2f1f4b2a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 282 additions and 299 deletions

View file

@ -2,10 +2,12 @@
use core::fmt::Display;
use crate::{math, CacheKey, CacheKeyFlags, Color};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
use crate::{math, CacheKey, CacheKeyFlags, Color};
#[cfg(not(feature = "std"))]
use core_maths::CoreFloat;
/// A laid out glyph
#[derive(Clone, Debug)]
@ -78,8 +80,8 @@ impl LayoutGlyph {
self.glyph_id,
self.font_size * scale,
(
(self.x + x_offset) * scale + offset.0,
math::truncf((self.y - y_offset) * scale + offset.1), // Hinting in Y axis
(self.x + x_offset).mul_add(scale, offset.0),
math::truncf((self.y - y_offset).mul_add(scale, offset.1)), // Hinting in Y axis
),
self.font_weight,
self.cache_key_flags,