File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Expand file tree Collapse file tree 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 {
4747/// assert_eq!(dlf.format(&dl), "192 | Example line of text");
4848/// ```
4949pub struct DisplayListFormatter {
50- stylesheet : Box < Stylesheet > ,
50+ stylesheet : Box < dyn Stylesheet > ,
5151}
5252
5353impl DisplayListFormatter {
@@ -101,7 +101,7 @@ impl DisplayListFormatter {
101101 }
102102 }
103103
104- fn get_annotation_style ( & self , annotation_type : & DisplayAnnotationType ) -> Box < Style > {
104+ fn get_annotation_style ( & self , annotation_type : & DisplayAnnotationType ) -> Box < dyn Style > {
105105 self . stylesheet . get_style ( match annotation_type {
106106 DisplayAnnotationType :: Error => StyleClass :: Error ,
107107 DisplayAnnotationType :: Warning => StyleClass :: Warning ,
Original file line number Diff line number Diff line change @@ -87,12 +87,12 @@ pub trait Style {
8787 fn paint ( & self , text : & str ) -> String ;
8888 /// The method used by the DisplayListFormatter to display the message
8989 /// in bold font.
90- fn bold ( & self ) -> Box < Style > ;
90+ fn bold ( & self ) -> Box < dyn Style > ;
9191}
9292
9393/// Trait to annotate structs that can provide `Style` implementations for
9494/// every `StyleClass` variant.
9595pub trait Stylesheet {
9696 /// 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 > ;
9898}
Original file line number Diff line number Diff line change 1+ #![ deny( rust_2018_idioms) ]
2+
13//! A library for formatting of text or programming code snippets.
24//!
35//! 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 {
77 text. to_string ( )
88 }
99
10- fn bold ( & self ) -> Box < Style > {
10+ fn bold ( & self ) -> Box < dyn Style > {
1111 Box :: new ( NoOpStyle { } )
1212 }
1313}
1414
1515pub struct NoColorStylesheet { }
1616
1717impl Stylesheet for NoColorStylesheet {
18- fn get_style ( & self , _class : StyleClass ) -> Box < Style > {
18+ fn get_style ( & self , _class : StyleClass ) -> Box < dyn Style > {
1919 Box :: new ( NoOpStyle { } )
2020 }
2121}
You can’t perform that action at this time.
0 commit comments