@@ -4,7 +4,7 @@ use ansi2::{css::Mode, theme::Theme};
44use ansi2:: { html:: to_html, svg:: to_svg, text:: to_text} ;
55use base64:: Engine ;
66use base64:: prelude:: BASE64_STANDARD ;
7- use clap:: { Parser , ValueEnum , command } ;
7+ use clap:: { Parser , ValueEnum } ;
88use std:: path:: Path ;
99use std:: { fs:: read, io:: Read } ;
1010
@@ -53,15 +53,14 @@ struct Args {
5353}
5454
5555fn process_input ( buf : Vec < u8 > ) -> String {
56- if let Some ( ty) = infer:: get ( & buf) {
57- if ty. matcher_type ( ) == infer:: MatcherType :: Image {
58- if let Some ( s) = image_to_ans ( & buf) {
59- return s;
60- }
61- }
56+ if let Some ( ty) = infer:: get ( & buf)
57+ && ty. matcher_type ( ) == infer:: MatcherType :: Image
58+ && let Some ( s) = image_to_ans ( & buf)
59+ {
60+ return s;
6261 }
6362
64- return String :: from_utf8_lossy ( & buf) . to_string ( ) ;
63+ String :: from_utf8_lossy ( & buf) . to_string ( )
6564}
6665fn main ( ) {
6766 let args: Args = Args :: parse ( ) ;
@@ -103,7 +102,7 @@ fn main() {
103102
104103 let bin = read ( font_url) . expect ( "read font file error" ) ;
105104 let base64 = BASE64_STANDARD . encode ( bin) ;
106- return format ! ( "data:font;base64,{base64}" ) ;
105+ format ! ( "data:font;base64,{base64}" )
107106 } ) ;
108107
109108 let output = match format {
0 commit comments