@@ -68,17 +68,12 @@ impl Display for SpaceOrNewline {
6868
6969/// A value that displays a comma-separated list of values.
7070/// When pretty-printed (using {:#}), it displays each value on a new line.
71- pub ( crate ) struct DisplayCommaSeparated < I , T : fmt:: Display > ( I )
72- where
73- I : IntoIterator < Item = T > + Clone ;
71+ pub ( crate ) struct DisplayCommaSeparated < ' a , T : fmt:: Display > ( & ' a [ T ] ) ;
7472
75- impl < I , T : fmt:: Display > fmt:: Display for DisplayCommaSeparated < I , T >
76- where
77- I : IntoIterator < Item = T > + Clone ,
78- {
73+ impl < ' a , T : fmt:: Display > fmt:: Display for DisplayCommaSeparated < ' a , T > {
7974 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
8075 let mut first = true ;
81- for t in self . 0 . clone ( ) {
76+ for t in self . 0 {
8277 if !first {
8378 f. write_char ( ',' ) ?;
8479 SpaceOrNewline . fmt ( f) ?;
@@ -91,12 +86,12 @@ where
9186}
9287
9388/// Displays a whitespace, followed by a comma-separated list that is indented when pretty-printed.
94- pub ( crate ) fn indented_list < I , T : fmt:: Display > ( f : & mut fmt :: Formatter , iter : I ) -> fmt :: Result
95- where
96- I : IntoIterator < Item = T > + Clone ,
97- {
89+ pub ( crate ) fn indented_list < ' a , T : fmt:: Display > (
90+ f : & mut fmt :: Formatter ,
91+ items : & ' a [ T ] ,
92+ ) -> fmt :: Result {
9893 SpaceOrNewline . fmt ( f) ?;
99- Indent ( DisplayCommaSeparated ( iter ) ) . fmt ( f)
94+ Indent ( DisplayCommaSeparated ( items ) ) . fmt ( f)
10095}
10196
10297#[ cfg( test) ]
0 commit comments