@@ -244,22 +244,20 @@ pub fn each_linked_rlib(
244244
245245 fmts
246246 } 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+ if let Some ( ( ( ty1, list1) , ( ty2, list2) ) ) = info
248+ . dependency_formats
249+ . iter ( )
250+ . tuple_combinations ( )
251+ . find ( |( ( _, list1) , ( _, list2) ) | list1 != list2)
252+ {
253+ return Err ( errors:: LinkRlibError :: IncompatibleDependencyFormats {
254+ ty1 : format ! ( "{ty1:?}" ) ,
255+ ty2 : format ! ( "{ty2:?}" ) ,
256+ list1 : format ! ( "{list1:?}" ) ,
257+ list2 : format ! ( "{list2:?}" ) ,
258+ } ) ;
261259 }
262- info. dependency_formats . first ( ) . unwrap ( ) . 1
260+ info. dependency_formats . first ( ) . ok_or ( errors :: LinkRlibError :: MissingFormat ) ? . 1
263261 } ;
264262
265263 let used_dep_crates = info. used_crates . iter ( ) ;
0 commit comments