@@ -145,7 +145,7 @@ pub struct PackageDependency {
145145 pub kind : DepKind ,
146146}
147147
148- #[ derive( Debug , Clone , Eq , PartialEq , PartialOrd , Ord ) ]
148+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
149149pub enum DepKind {
150150 /// Available to the library, binary, and dev targets in the package (but not the build script).
151151 Normal ,
@@ -156,23 +156,20 @@ pub enum DepKind {
156156}
157157
158158impl DepKind {
159- fn iter ( list : & [ cargo_metadata:: DepKindInfo ] ) -> impl Iterator < Item = Self > + ' _ {
160- let mut dep_kinds = Vec :: new ( ) ;
159+ fn iter ( list : & [ cargo_metadata:: DepKindInfo ] ) -> impl Iterator < Item = Self > {
160+ let mut dep_kinds = [ None ; 3 ] ;
161161 if list. is_empty ( ) {
162- dep_kinds. push ( Self :: Normal ) ;
162+ dep_kinds[ 0 ] = Some ( Self :: Normal ) ;
163163 }
164164 for info in list {
165- let kind = match info. kind {
166- cargo_metadata:: DependencyKind :: Normal => Self :: Normal ,
167- cargo_metadata:: DependencyKind :: Development => Self :: Dev ,
168- cargo_metadata:: DependencyKind :: Build => Self :: Build ,
165+ match info. kind {
166+ cargo_metadata:: DependencyKind :: Normal => dep_kinds [ 0 ] = Some ( Self :: Normal ) ,
167+ cargo_metadata:: DependencyKind :: Development => dep_kinds [ 1 ] = Some ( Self :: Dev ) ,
168+ cargo_metadata:: DependencyKind :: Build => dep_kinds [ 2 ] = Some ( Self :: Build ) ,
169169 cargo_metadata:: DependencyKind :: Unknown => continue ,
170- } ;
171- dep_kinds. push ( kind) ;
170+ }
172171 }
173- dep_kinds. sort_unstable ( ) ;
174- dep_kinds. dedup ( ) ;
175- dep_kinds. into_iter ( )
172+ dep_kinds. into_iter ( ) . flatten ( )
176173 }
177174}
178175
0 commit comments