fix(rust): make some methods const
Addresses clippy::missing-const-for-fn
This commit is contained in:
parent
ed91767663
commit
b57b7213a9
4 changed files with 8 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ impl TagsContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parser(&mut self) -> &mut Parser {
|
||||
pub const fn parser(&mut self) -> &mut Parser {
|
||||
&mut self.parser
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue