From b57b7213a9fb43c4d06f738a913aa7d55c805141 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 20 Aug 2025 14:04:13 +0300 Subject: [PATCH] fix(rust): make some methods `const` Addresses clippy::missing-const-for-fn --- crates/generate/src/node_types.rs | 4 ++-- crates/highlight/src/highlight.rs | 4 ++-- crates/loader/src/loader.rs | 6 +++--- crates/tags/src/tags.rs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/generate/src/node_types.rs b/crates/generate/src/node_types.rs index 07be52c6..6ebb5e6d 100644 --- a/crates/generate/src/node_types.rs +++ b/crates/generate/src/node_types.rs @@ -102,7 +102,7 @@ impl ChildQuantity { } } - fn append(&mut self, other: Self) { + const fn append(&mut self, other: Self) { if other.exists { if self.exists || other.multiple { self.multiple = true; @@ -114,7 +114,7 @@ impl ChildQuantity { } } - fn union(&mut self, other: Self) -> bool { + const fn union(&mut self, other: Self) -> bool { let mut result = false; if !self.exists && other.exists { result = true; diff --git a/crates/highlight/src/highlight.rs b/crates/highlight/src/highlight.rs index 1f76bfc3..ee617124 100644 --- a/crates/highlight/src/highlight.rs +++ b/crates/highlight/src/highlight.rs @@ -275,7 +275,7 @@ impl Highlighter { } } - pub fn parser(&mut self) -> &mut Parser { + pub const fn parser(&mut self) -> &mut Parser { &mut self.parser } @@ -1098,7 +1098,7 @@ impl HtmlRenderer { result } - pub fn set_carriage_return_highlight(&mut self, highlight: Option) { + pub const fn set_carriage_return_highlight(&mut self, highlight: Option) { self.carriage_return_highlight = highlight; } diff --git a/crates/loader/src/loader.rs b/crates/loader/src/loader.rs index 1c93a54d..b6086f5c 100644 --- a/crates/loader/src/loader.rs +++ b/crates/loader/src/loader.rs @@ -1455,15 +1455,15 @@ impl Loader { } } - pub fn debug_build(&mut self, flag: bool) { + pub const fn debug_build(&mut self, flag: bool) { self.debug_build = flag; } - pub fn sanitize_build(&mut self, flag: bool) { + pub const fn sanitize_build(&mut self, flag: bool) { self.sanitize_build = flag; } - pub fn force_rebuild(&mut self, rebuild: bool) { + pub const fn force_rebuild(&mut self, rebuild: bool) { self.force_rebuild = rebuild; } diff --git a/crates/tags/src/tags.rs b/crates/tags/src/tags.rs index b139ce00..8334fac2 100644 --- a/crates/tags/src/tags.rs +++ b/crates/tags/src/tags.rs @@ -274,7 +274,7 @@ impl TagsContext { } } - pub fn parser(&mut self) -> &mut Parser { + pub const fn parser(&mut self) -> &mut Parser { &mut self.parser }