@@ -244,22 +244,17 @@ pub fn each_linked_rlib(
244
244
245
245
fmts
246
246
} else {
247
- for combination in info. dependency_formats . iter ( ) . combinations ( 2 ) {
248
- let ( ty1, list1) = & combination[ 0 ] ;
249
- let ( ty2, list2) = & combination[ 1 ] ;
250
- if list1 != list2 {
251
- return Err ( errors:: LinkRlibError :: IncompatibleDependencyFormats {
252
- ty1 : format ! ( "{ty1:?}" ) ,
253
- ty2 : format ! ( "{ty2:?}" ) ,
254
- list1 : format ! ( "{list1:?}" ) ,
255
- list2 : format ! ( "{list2:?}" ) ,
256
- } ) ;
257
- }
258
- }
259
- if info. dependency_formats . is_empty ( ) {
260
- return Err ( errors:: LinkRlibError :: MissingFormat ) ;
247
+ let mut dep_formats = info. dependency_formats . iter ( ) ;
248
+ let ( ty1, list1) = dep_formats. next ( ) . ok_or ( errors:: LinkRlibError :: MissingFormat ) ?;
249
+ if let Some ( ( ty2, list2) ) = dep_formats. find ( |( _, list2) | list1 != * list2) {
250
+ return Err ( errors:: LinkRlibError :: IncompatibleDependencyFormats {
251
+ ty1 : format ! ( "{ty1:?}" ) ,
252
+ ty2 : format ! ( "{ty2:?}" ) ,
253
+ list1 : format ! ( "{list1:?}" ) ,
254
+ list2 : format ! ( "{list2:?}" ) ,
255
+ } ) ;
261
256
}
262
- info . dependency_formats . first ( ) . unwrap ( ) . 1
257
+ list1
263
258
} ;
264
259
265
260
let used_dep_crates = info. used_crates . iter ( ) ;
0 commit comments