Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d87d015

Browse files
committed
refactor(renderer): Make functions const
1 parent 881d164 commit d87d015

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎src/renderer/mod.rs

Lines changed: 13 additions & 13 deletions
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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn 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 constfn none(mut self, style: Style) -> Self {
9999
self.stylesheet.none = style;
100100
self
101101
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /