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 f7b18ae

Browse files
committed
refactor(renderer): Make functions const
1 parent 2ba2ec4 commit f7b18ae

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
@@ -17,16 +17,16 @@ pub struct Renderer {
1717

1818
impl Renderer {
1919
/// No terminal styling
20-
pub fn plain() -> Self {
20+
pub constfn plain() -> Self {
2121
Self {
2222
anonymized_line_numbers: false,
2323
margin: None,
24-
stylesheet: Stylesheet::default(),
24+
stylesheet: Stylesheet::plain(),
2525
}
2626
}
2727

2828
/// Default terminal styling
29-
pub fn styled() -> Self {
29+
pub constfn styled() -> Self {
3030
Self {
3131
stylesheet: Stylesheet {
3232
error: AnsiColor::BrightRed.on_default().effects(Effects::BOLD),
@@ -42,52 +42,52 @@ impl Renderer {
4242
}
4343
}
4444

45-
pub fn anonymized_line_numbers(mut self, anonymized_line_numbers: bool) -> Self {
45+
pub constfn anonymized_line_numbers(mut self, anonymized_line_numbers: bool) -> Self {
4646
self.anonymized_line_numbers = anonymized_line_numbers;
4747
self
4848
}
4949

50-
pub fn margin(mut self, margin: Option<Margin>) -> Self {
50+
pub constfn margin(mut self, margin: Option<Margin>) -> Self {
5151
self.margin = margin;
5252
self
5353
}
5454

55-
pub fn error(mut self, style: Style) -> Self {
55+
pub constfn error(mut self, style: Style) -> Self {
5656
self.stylesheet.error = style;
5757
self
5858
}
5959

60-
pub fn warning(mut self, style: Style) -> Self {
60+
pub constfn warning(mut self, style: Style) -> Self {
6161
self.stylesheet.warning = style;
6262
self
6363
}
6464

65-
pub fn info(mut self, style: Style) -> Self {
65+
pub constfn info(mut self, style: Style) -> Self {
6666
self.stylesheet.info = style;
6767
self
6868
}
6969

70-
pub fn note(mut self, style: Style) -> Self {
70+
pub constfn note(mut self, style: Style) -> Self {
7171
self.stylesheet.note = style;
7272
self
7373
}
7474

75-
pub fn help(mut self, style: Style) -> Self {
75+
pub constfn help(mut self, style: Style) -> Self {
7676
self.stylesheet.help = style;
7777
self
7878
}
7979

80-
pub fn line_no(mut self, style: Style) -> Self {
80+
pub constfn line_no(mut self, style: Style) -> Self {
8181
self.stylesheet.line_no = style;
8282
self
8383
}
8484

85-
pub fn emphasis(mut self, style: Style) -> Self {
85+
pub constfn emphasis(mut self, style: Style) -> Self {
8686
self.stylesheet.emphasis = style;
8787
self
8888
}
8989

90-
pub fn none(mut self, style: Style) -> Self {
90+
pub constfn none(mut self, style: Style) -> Self {
9191
self.stylesheet.none = style;
9292
self
9393
}

0 commit comments

Comments
(0)

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