@@ -48,17 +48,19 @@ pub fn compile(input_dir: &str, output_dir: &str, config_path: &str) {
4848 match Post :: from_markdown_file ( entry. path ( ) ) {
4949 Ok ( Some ( post) ) => posts. push ( post) ,
5050 Ok ( None ) => {
51- println ! ( "Skipping unpublished post: {}" , entry. path( ) . display( ) ) ;
51+ let path = entry. path ( ) . display ( ) ;
52+ println ! ( "Skipping unpublished post: {path}" ) ;
5253 }
5354 Err ( e) => {
54- eprintln ! ( "Error parsing {}: {}" , entry. path( ) . display( ) , e) ;
55+ let path = entry. path ( ) . display ( ) ;
56+ eprintln ! ( "Error parsing {path}: {e}" ) ;
5557 }
5658 }
5759 }
5860 posts. sort_by ( |a, b| b. meta . published_at . cmp ( & a. meta . published_at ) ) ;
5961
6062 // Build post pages
61- let icon_path_rel = format ! ( "../{}" , icon_file_name ) ;
63+ let icon_path_rel = format ! ( "../{icon_file_name}" ) ;
6264 let aside = html:: aside_html (
6365 & config. owner . name ,
6466 & config. owner . github_link ,
@@ -90,7 +92,7 @@ pub fn compile(input_dir: &str, output_dir: &str, config_path: &str) {
9092
9193 let post_paths: Vec < String > = posts
9294 . iter ( )
93- . map ( |post| format ! ( "{}.html" , post. name) )
95+ . map ( |post| format ! ( "{name }.html" , name = post. name) )
9496 . collect ( ) ;
9597
9698 println ! ( "\n Output directory structure:" ) ;
@@ -105,15 +107,16 @@ pub fn compile(input_dir: &str, output_dir: &str, config_path: &str) {
105107 // Show top/bottom posts only if many
106108 if post_paths. len ( ) > 10 {
107109 for path in & post_paths[ ..3 ] {
108- println ! ( "│ ├── {}" , path ) ;
110+ println ! ( "│ ├── {path}" ) ;
109111 }
110- println ! ( "│ ├── ... ({} posts omitted)" , post_paths. len( ) - 6 ) ;
112+ let omitted = post_paths. len ( ) - 6 ;
113+ println ! ( "│ ├── ... ({omitted} posts omitted)" ) ;
111114 for path in & post_paths[ post_paths. len ( ) - 3 ..] {
112- println ! ( "│ ├── {}" , path ) ;
115+ println ! ( "│ ├── {path}" ) ;
113116 }
114117 } else {
115118 for path in & post_paths {
116- println ! ( "│ ├── {}" , path ) ;
119+ println ! ( "│ ├── {path}" ) ;
117120 }
118121 }
119122
@@ -126,11 +129,11 @@ fn css_filename_with_hash(css_path: &Path) -> Option<String> {
126129 let mut hasher = Sha256 :: new ( ) ;
127130 hasher. update ( & bytes) ;
128131 let hash = hasher. finalize ( ) ;
129- let hash_hex = format ! ( "{:x}" , hash ) ;
132+ let hash_hex = format ! ( "{hash :x}" ) ;
130133
131- Some ( format ! ( "style.{}.css" , & hash_hex[ ..8 ] ) )
134+ Some ( format ! ( "style.{hash }.css" , hash = & hash_hex[ ..8 ] ) )
132135 } else {
133- eprintln ! ( "CSS file not found: {:?}" , css_path ) ;
136+ eprintln ! ( "CSS file not found: {css_path :?}" ) ;
134137 None
135138 }
136139}
@@ -139,7 +142,7 @@ fn copy_file(src: &Path, dest: &Path, description: &str) -> std::io::Result<()>
139142 if src. exists ( ) {
140143 fs:: copy ( src, dest) ?;
141144 } else {
142- eprintln ! ( "{} not found: {:?}" , description , src ) ;
145+ eprintln ! ( "{description } not found: {src :?}" ) ;
143146 }
144147 Ok ( ( ) )
145148}
@@ -157,7 +160,7 @@ fn copy_images(src_dir: &Path, dest_dir: &Path) {
157160 }
158161 }
159162 } else {
160- eprintln ! ( "Images directory not found: {:?}" , src_dir ) ;
163+ eprintln ! ( "Images directory not found: {src_dir :?}" ) ;
161164 }
162165}
163166
@@ -170,10 +173,12 @@ fn build_post_pages(
170173 css_filename : & str ,
171174) {
172175 for post in posts {
173- let output_path = output_dir. join ( "posts" ) . join ( format ! ( "{}.html" , post. name) ) ;
176+ let output_path = output_dir
177+ . join ( "posts" )
178+ . join ( format ! ( "{name}.html" , name = post. name) ) ;
174179 fs:: create_dir_all ( output_path. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
175180
176- let css_relative_path = format ! ( "../{}" , css_filename ) ;
181+ let css_relative_path = format ! ( "../{css_filename}" ) ;
177182 let post_html = html:: post_html ( post, aside, footer, icon, & css_relative_path) ;
178183 fs:: write ( & output_path, post_html) . unwrap ( ) ;
179184 }
0 commit comments