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:
parent
e80dbc3607
commit
a2f1f4b2a0
20 changed files with 282 additions and 299 deletions
|
|
@ -11,7 +11,7 @@ pub enum Cached<T: Clone + Debug> {
|
|||
|
||||
impl<T: Clone + Debug> Cached<T> {
|
||||
/// Gets the value if in state `Self::Used`.
|
||||
pub fn get(&self) -> Option<&T> {
|
||||
pub const fn get(&self) -> Option<&T> {
|
||||
match self {
|
||||
Self::Empty | Self::Unused(_) => None,
|
||||
Self::Used(t) => Some(t),
|
||||
|
|
@ -27,7 +27,7 @@ impl<T: Clone + Debug> Cached<T> {
|
|||
}
|
||||
|
||||
/// Checks if the value is empty or unused.
|
||||
pub fn is_unused(&self) -> bool {
|
||||
pub const fn is_unused(&self) -> bool {
|
||||
match self {
|
||||
Self::Empty | Self::Unused(_) => true,
|
||||
Self::Used(_) => false,
|
||||
|
|
@ -35,7 +35,7 @@ impl<T: Clone + Debug> Cached<T> {
|
|||
}
|
||||
|
||||
/// Checks if the value is used (i.e. cached for access).
|
||||
pub fn is_used(&self) -> bool {
|
||||
pub const fn is_used(&self) -> bool {
|
||||
match self {
|
||||
Self::Empty | Self::Unused(_) => false,
|
||||
Self::Used(_) => true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue