File tree 4 files changed +8
-6
lines changed
4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ fn repeat_char(c: char, n: usize) -> String {
47
47
/// assert_eq!(dlf.format(&dl), "192 | Example line of text");
48
48
/// ```
49
49
pub struct DisplayListFormatter {
50
- stylesheet : Box < Stylesheet > ,
50
+ stylesheet : Box < dyn Stylesheet > ,
51
51
}
52
52
53
53
impl DisplayListFormatter {
@@ -101,7 +101,7 @@ impl DisplayListFormatter {
101
101
}
102
102
}
103
103
104
- fn get_annotation_style ( & self , annotation_type : & DisplayAnnotationType ) -> Box < Style > {
104
+ fn get_annotation_style ( & self , annotation_type : & DisplayAnnotationType ) -> Box < dyn Style > {
105
105
self . stylesheet . get_style ( match annotation_type {
106
106
DisplayAnnotationType :: Error => StyleClass :: Error ,
107
107
DisplayAnnotationType :: Warning => StyleClass :: Warning ,
Original file line number Diff line number Diff line change @@ -87,12 +87,12 @@ pub trait Style {
87
87
fn paint ( & self , text : & str ) -> String ;
88
88
/// The method used by the DisplayListFormatter to display the message
89
89
/// in bold font.
90
- fn bold ( & self ) -> Box < Style > ;
90
+ fn bold ( & self ) -> Box < dyn Style > ;
91
91
}
92
92
93
93
/// Trait to annotate structs that can provide `Style` implementations for
94
94
/// every `StyleClass` variant.
95
95
pub trait Stylesheet {
96
96
/// Returns a `Style` implementer based on the requested `StyleClass` variant.
97
- fn get_style ( & self , class : StyleClass ) -> Box < Style > ;
97
+ fn get_style ( & self , class : StyleClass ) -> Box < dyn Style > ;
98
98
}
Original file line number Diff line number Diff line change
1
+ #![ deny( rust_2018_idioms) ]
2
+
1
3
//! A library for formatting of text or programming code snippets.
2
4
//!
3
5
//! It's primary purpose is to build an ASCII-graphical representation of the snippet
Original file line number Diff line number Diff line change @@ -7,15 +7,15 @@ impl Style for NoOpStyle {
7
7
text. to_string ( )
8
8
}
9
9
10
- fn bold ( & self ) -> Box < Style > {
10
+ fn bold ( & self ) -> Box < dyn Style > {
11
11
Box :: new ( NoOpStyle { } )
12
12
}
13
13
}
14
14
15
15
pub struct NoColorStylesheet { }
16
16
17
17
impl Stylesheet for NoColorStylesheet {
18
- fn get_style ( & self , _class : StyleClass ) -> Box < Style > {
18
+ fn get_style ( & self , _class : StyleClass ) -> Box < dyn Style > {
19
19
Box :: new ( NoOpStyle { } )
20
20
}
21
21
}
You can’t perform that action at this time.
0 commit comments