Skip to content

Commit 5c6171b

Browse files
committed
refactor(renderer): Make functions const
1 parent 9dd7d02 commit 5c6171b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Diff for: src/renderer/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ impl Renderer {
2424
}
2525

2626
/// No terminal styling
27-
pub fn plain() -> Self {
27+
pub const fn plain() -> Self {
2828
Self {
2929
anonymized_line_numbers: false,
3030
margin: None,
31-
stylesheet: StyleSheet::default(),
31+
stylesheet: StyleSheet::const_default(),
3232
}
3333
}
3434

3535
/// Default terminal styling
36-
pub fn styled() -> Self {
36+
pub const fn styled() -> Self {
3737
Self {
3838
anonymized_line_numbers: false,
3939
margin: None,
@@ -50,52 +50,52 @@ impl Renderer {
5050
}
5151
}
5252

53-
pub fn anonymized_line_numbers(mut self, anonymized_line_numbers: bool) -> Self {
53+
pub const fn anonymized_line_numbers(mut self, anonymized_line_numbers: bool) -> Self {
5454
self.anonymized_line_numbers = anonymized_line_numbers;
5555
self
5656
}
5757

58-
pub fn margin(mut self, margin: Option<Margin>) -> Self {
58+
pub const fn margin(mut self, margin: Option<Margin>) -> Self {
5959
self.margin = margin;
6060
self
6161
}
6262

63-
pub fn error(mut self, style: Style) -> Self {
63+
pub const fn error(mut self, style: Style) -> Self {
6464
self.stylesheet.error = style;
6565
self
6666
}
6767

68-
pub fn warning(mut self, style: Style) -> Self {
68+
pub const fn warning(mut self, style: Style) -> Self {
6969
self.stylesheet.warning = style;
7070
self
7171
}
7272

73-
pub fn info(mut self, style: Style) -> Self {
73+
pub const fn info(mut self, style: Style) -> Self {
7474
self.stylesheet.info = style;
7575
self
7676
}
7777

78-
pub fn note(mut self, style: Style) -> Self {
78+
pub const fn note(mut self, style: Style) -> Self {
7979
self.stylesheet.note = style;
8080
self
8181
}
8282

83-
pub fn help(mut self, style: Style) -> Self {
83+
pub const fn help(mut self, style: Style) -> Self {
8484
self.stylesheet.help = style;
8585
self
8686
}
8787

88-
pub fn line_no(mut self, style: Style) -> Self {
88+
pub const fn line_no(mut self, style: Style) -> Self {
8989
self.stylesheet.line_no = style;
9090
self
9191
}
9292

93-
pub fn emphasis(mut self, style: Style) -> Self {
93+
pub const fn emphasis(mut self, style: Style) -> Self {
9494
self.stylesheet.emphasis = style;
9595
self
9696
}
9797

98-
pub fn none(mut self, style: Style) -> Self {
98+
pub const fn none(mut self, style: Style) -> Self {
9999
self.stylesheet.none = style;
100100
self
101101
}

0 commit comments

Comments
 (0)