File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -205,11 +205,10 @@ impl fmt::Display for UseSegment {
205
205
UseSegment :: List ( ref list) => {
206
206
write ! ( f, "{{" ) ?;
207
207
for ( i, item) in list. iter ( ) . enumerate ( ) {
208
- let is_last = i == list. len ( ) - 1 ;
209
- write ! ( f, "{}" , item) ?;
210
- if !is_last {
208
+ if i != 0 {
211
209
write ! ( f, ", " ) ?;
212
210
}
211
+ write ! ( f, "{}" , item) ?;
213
212
}
214
213
write ! ( f, "}}" )
215
214
}
@@ -219,11 +218,10 @@ impl fmt::Display for UseSegment {
219
218
impl fmt:: Display for UseTree {
220
219
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
221
220
for ( i, segment) in self . path . iter ( ) . enumerate ( ) {
222
- let is_last = i == self . path . len ( ) - 1 ;
223
- write ! ( f, "{}" , segment) ?;
224
- if !is_last {
221
+ if i != 0 {
225
222
write ! ( f, "::" ) ?;
226
223
}
224
+ write ! ( f, "{}" , segment) ?;
227
225
}
228
226
Ok ( ( ) )
229
227
}
You can’t perform that action at this time.
0 commit comments