fix(rust): make some methods const

Addresses clippy::missing-const-for-fn
This commit is contained in:
ObserverOfTime 2025-08-20 14:04:13 +03:00
parent ed91767663
commit b57b7213a9
4 changed files with 8 additions and 8 deletions

View file

@ -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;

View file

@ -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<Highlight>) {
pub const fn set_carriage_return_highlight(&mut self, highlight: Option<Highlight>) {
self.carriage_return_highlight = highlight;
}

View file

@ -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;
}

View file

@ -274,7 +274,7 @@ impl TagsContext {
}
}
pub fn parser(&mut self) -> &mut Parser {
pub const fn parser(&mut self) -> &mut Parser {
&mut self.parser
}