@@ -575,56 +575,33 @@ fn show_preview(
575
575
}
576
576
577
577
let is_heic;
578
- let is_webp;
579
578
if let Some ( extension) = Path :: new ( & name) . extension ( ) {
580
579
let extension = format ! ( ".{}" , extension. to_string_lossy( ) . to_lowercase( ) ) ;
581
580
is_heic = HEIC_EXTENSIONS . contains ( & extension. as_str ( ) ) ;
582
- is_webp = ".webp" == extension;
583
581
if !RAW_IMAGE_EXTENSIONS . contains ( & extension. as_str ( ) ) && !IMAGE_RS_EXTENSIONS . contains ( & extension. as_str ( ) ) && !is_heic {
584
582
break ' dir;
585
583
}
586
584
} else {
587
585
break ' dir;
588
586
}
589
- let mut pixbuf = if is_heic || is_webp {
590
- let image = if is_heic {
591
- #[ cfg( feature = "heif" ) ]
592
- match get_dynamic_image_from_heic ( file_name) {
593
- Ok ( t) => t,
594
- Err ( e) => {
595
- add_text_to_text_view (
596
- text_view_errors,
597
- flg ! (
598
- "preview_image_opening_failure" ,
599
- generate_translation_hashmap( vec![ ( "name" , file_name. to_string( ) ) , ( "reason" , e. to_string( ) ) ] )
600
- )
601
- . as_str ( ) ,
602
- ) ;
603
- break ' dir;
604
- }
605
- }
606
-
607
- #[ cfg( not( feature = "heif" ) ) ]
608
- panic ! ( "" )
609
- } else if is_webp {
610
- match image:: open ( file_name) {
611
- Ok ( t) => t,
612
- Err ( e) => {
613
- add_text_to_text_view (
614
- text_view_errors,
615
- flg ! (
616
- "preview_image_opening_failure" ,
617
- generate_translation_hashmap( vec![ ( "name" , file_name. to_string( ) ) , ( "reason" , e. to_string( ) ) ] )
618
- )
619
- . as_str ( ) ,
620
- ) ;
621
- break ' dir;
622
- }
587
+ let mut pixbuf = if cfg ! ( feature = "heif" ) && is_heic {
588
+ #[ cfg( feature = "heif" ) ]
589
+ let image = match get_dynamic_image_from_heic ( file_name) {
590
+ Ok ( t) => t,
591
+ Err ( e) => {
592
+ add_text_to_text_view (
593
+ text_view_errors,
594
+ flg ! (
595
+ "preview_image_opening_failure" ,
596
+ generate_translation_hashmap( vec![ ( "name" , file_name. to_string( ) ) , ( "reason" , e. to_string( ) ) ] )
597
+ )
598
+ . as_str ( ) ,
599
+ ) ;
600
+ break ' dir;
623
601
}
624
- } else {
625
- panic ! ( "" ) ;
626
602
} ;
627
603
604
+ #[ cfg( feature = "heif" ) ]
628
605
match get_pixbuf_from_dynamic_image ( & image) {
629
606
Ok ( t) => t,
630
607
Err ( e) => {
@@ -639,6 +616,9 @@ fn show_preview(
639
616
break ' dir;
640
617
}
641
618
}
619
+
620
+ #[ cfg( not( feature = "heif" ) ) ]
621
+ unreachable ! ( )
642
622
} else {
643
623
match Pixbuf :: from_file ( file_name) {
644
624
Ok ( pixbuf) => pixbuf,
0 commit comments