From 53cb50316e8bf181dcf0088b55e09f7be8d5990b Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 3 Dec 2025 10:44:07 -0500 Subject: [PATCH] remove impl const --- parsing/src/autocomplete.rs | 20 ++++++++++++++------ parsing/src/parsing.rs | 18 +++++++++++++----- src/function_entry.rs | 2 +- src/math_app.rs | 4 ++-- src/misc.rs | 2 +- 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/parsing/src/autocomplete.rs b/parsing/src/autocomplete.rs index f01f67b..2bf5c49 100644 --- a/parsing/src/autocomplete.rs +++ b/parsing/src/autocomplete.rs @@ -13,13 +13,19 @@ pub enum Movement { } impl Movement { - pub const fn is_none(&self) -> bool { matches!(&self, &Self::None) } + pub const fn is_none(&self) -> bool { + matches!(&self, &Self::None) + } - pub const fn is_complete(&self) -> bool { matches!(&self, &Self::Complete) } + pub const fn is_complete(&self) -> bool { + matches!(&self, &Self::Complete) + } } -impl const Default for Movement { - fn default() -> Self { Self::None } +impl Default for Movement { + fn default() -> Self { + Self::None + } } #[derive(Clone, PartialEq)] @@ -29,8 +35,10 @@ pub struct AutoComplete<'a> { pub string: String, } -impl<'a> const Default for AutoComplete<'a> { - fn default() -> AutoComplete<'a> { AutoComplete::EMPTY } +impl<'a> Default for AutoComplete<'a> { + fn default() -> AutoComplete<'a> { + AutoComplete::EMPTY + } } impl<'a> AutoComplete<'a> { diff --git a/parsing/src/parsing.rs b/parsing/src/parsing.rs index cbed0dc..fbb8b2f 100644 --- a/parsing/src/parsing.rs +++ b/parsing/src/parsing.rs @@ -22,7 +22,9 @@ impl FlatExWrapper { } #[inline] - const fn is_none(&self) -> bool { self.func.is_none() } + const fn is_none(&self) -> bool { + self.func.is_none() + } #[inline] pub fn eval(&self, x: &[f64]) -> f64 { @@ -66,8 +68,10 @@ impl FlatExWrapper { } } -impl const Default for FlatExWrapper { - fn default() -> FlatExWrapper { FlatExWrapper::EMPTY } +impl Default for FlatExWrapper { + fn default() -> FlatExWrapper { + FlatExWrapper::EMPTY + } } /// Function that includes f(x), f'(x), f'(x)'s string representation, and f''(x) #[derive(Clone, PartialEq)] @@ -80,11 +84,15 @@ pub struct BackingFunction { } impl Default for BackingFunction { - fn default() -> Self { Self::new("").unwrap() } + fn default() -> Self { + Self::new("").unwrap() + } } impl BackingFunction { - pub const fn is_none(&self) -> bool { self.function.is_none() } + pub const fn is_none(&self) -> bool { + self.function.is_none() + } /// Create new [`BackingFunction`] instance pub fn new(func_str: &str) -> Result { diff --git a/src/function_entry.rs b/src/function_entry.rs index 385e9e6..2cc7729 100644 --- a/src/function_entry.rs +++ b/src/function_entry.rs @@ -118,7 +118,7 @@ impl<'de> Deserialize<'de> for FunctionEntry { } } -impl const Default for FunctionEntry { +impl Default for FunctionEntry { /// Creates default FunctionEntry instance (which is empty) fn default() -> FunctionEntry { FunctionEntry { diff --git a/src/math_app.rs b/src/math_app.rs index afb36c5..ed16f5d 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -51,7 +51,7 @@ pub struct AppSettings { pub plot_width: usize, } -impl const Default for AppSettings { +impl Default for AppSettings { /// Default implementation of `AppSettings`, this is how the application starts up fn default() -> Self { Self { @@ -84,7 +84,7 @@ struct Opened { pub welcome: bool, } -impl const Default for Opened { +impl Default for Opened { fn default() -> Opened { Self { help: false, diff --git a/src/misc.rs b/src/misc.rs index 2d84973..3f8bd89 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -46,7 +46,7 @@ pub trait Offset { fn offset_x(self, x_offset: f32) -> Pos2; } -impl const Offset for Pos2 { +impl Offset for Pos2 { fn offset_y(self, y_offset: f32) -> Pos2 { Pos2 { x: self.x,