@@ -536,7 +536,7 @@ pub fn info(args: InfoArgs) -> Result<()> {
536
536
537
537
println ! ( "{}:" , obj. name) ;
538
538
if let Some ( entry) = obj. entry {
539
- println ! ( "Entry point: {:#010X}" , entry ) ;
539
+ println ! ( "Entry point: {entry :#010X}" ) ;
540
540
}
541
541
println ! ( "\n Sections:" ) ;
542
542
println ! ( "\t {: >10} | {: <10} | {: <10} | {: <10}" , "Name" , "Address" , "Size" , "File Off" ) ;
@@ -955,7 +955,7 @@ fn split_write_obj(
955
955
DirBuilder :: new ( )
956
956
. recursive ( true )
957
957
. create ( out_dir)
958
- . with_context ( || format ! ( "Failed to create out dir '{}'" , out_dir ) ) ?;
958
+ . with_context ( || format ! ( "Failed to create out dir '{out_dir }'" ) ) ?;
959
959
let obj_dir = out_dir. join ( "obj" ) ;
960
960
let entry = if module. obj . kind == ObjKind :: Executable {
961
961
module. obj . entry . and_then ( |e| {
@@ -1056,9 +1056,8 @@ fn split_write_obj(
1056
1056
// Generate ldscript.lcf
1057
1057
let ldscript_template = if let Some ( template_path) = & module. config . ldscript_template {
1058
1058
let template_path = template_path. with_encoding ( ) ;
1059
- let template = fs:: read_to_string ( & template_path) . with_context ( || {
1060
- format ! ( "Failed to read linker script template '{}'" , template_path)
1061
- } ) ?;
1059
+ let template = fs:: read_to_string ( & template_path)
1060
+ . with_context ( || format ! ( "Failed to read linker script template '{template_path}'" ) ) ?;
1062
1061
module. dep . push ( template_path) ;
1063
1062
Some ( template)
1064
1063
} else {
@@ -1076,8 +1075,7 @@ fn split_write_obj(
1076
1075
let out_path = asm_dir. join ( asm_path_for_unit ( & unit. name ) ) ;
1077
1076
1078
1077
let mut w = buf_writer ( & out_path) ?;
1079
- write_asm ( & mut w, split_obj)
1080
- . with_context ( || format ! ( "Failed to write {}" , out_path) ) ?;
1078
+ write_asm ( & mut w, split_obj) . with_context ( || format ! ( "Failed to write {out_path}" ) ) ?;
1081
1079
w. flush ( ) ?;
1082
1080
}
1083
1081
}
@@ -1094,7 +1092,7 @@ fn write_if_changed(path: &Utf8NativePath, contents: &[u8]) -> Result<()> {
1094
1092
return Ok ( ( ) ) ;
1095
1093
}
1096
1094
}
1097
- fs:: write ( path, contents) . with_context ( || format ! ( "Failed to write file '{}'" , path ) ) ?;
1095
+ fs:: write ( path, contents) . with_context ( || format ! ( "Failed to write file '{path }'" ) ) ?;
1098
1096
Ok ( ( ) )
1099
1097
}
1100
1098
@@ -2166,7 +2164,7 @@ impl ObjectBase {
2166
2164
}
2167
2165
base. join ( path. with_encoding ( ) )
2168
2166
}
2169
- ObjectBase :: Vfs ( base, _) => Utf8NativePathBuf :: from ( format ! ( "{}:{}" , base , path ) ) ,
2167
+ ObjectBase :: Vfs ( base, _) => Utf8NativePathBuf :: from ( format ! ( "{base }:{path}" ) ) ,
2170
2168
}
2171
2169
}
2172
2170
@@ -2183,7 +2181,7 @@ impl ObjectBase {
2183
2181
}
2184
2182
ObjectBase :: Vfs ( vfs_path, vfs) => {
2185
2183
open_file_with_fs ( vfs. clone ( ) , & path. with_encoding ( ) , true )
2186
- . with_context ( || format ! ( "Using disc image {}" , vfs_path ) )
2184
+ . with_context ( || format ! ( "Using disc image {vfs_path}" ) )
2187
2185
}
2188
2186
}
2189
2187
}
@@ -2201,26 +2199,26 @@ pub fn find_object_base(config: &ProjectConfig) -> Result<ObjectBase> {
2201
2199
if let Some ( base) = & config. object_base {
2202
2200
let base = base. with_encoding ( ) ;
2203
2201
// Search for disc images in the object base directory
2204
- for result in fs:: read_dir ( & base) . with_context ( || format ! ( "Reading directory {}" , base ) ) ? {
2205
- let entry = result. with_context ( || format ! ( "Reading entry in directory {}" , base ) ) ?;
2202
+ for result in fs:: read_dir ( & base) . with_context ( || format ! ( "Reading directory {base}" ) ) ? {
2203
+ let entry = result. with_context ( || format ! ( "Reading entry in directory {base}" ) ) ?;
2206
2204
let Ok ( path) = check_path_buf ( entry. path ( ) ) else {
2207
2205
log:: warn!( "Path is not valid UTF-8: {:?}" , entry. path( ) ) ;
2208
2206
continue ;
2209
2207
} ;
2210
2208
let file_type =
2211
- entry. file_type ( ) . with_context ( || format ! ( "Getting file type for {}" , path ) ) ?;
2209
+ entry. file_type ( ) . with_context ( || format ! ( "Getting file type for {path}" ) ) ?;
2212
2210
let is_file = if file_type. is_symlink ( ) {
2213
2211
// Also traverse symlinks to files
2214
2212
fs:: metadata ( & path)
2215
- . with_context ( || format ! ( "Getting metadata for {}" , path ) ) ?
2213
+ . with_context ( || format ! ( "Getting metadata for {path}" ) ) ?
2216
2214
. is_file ( )
2217
2215
} else {
2218
2216
file_type. is_file ( )
2219
2217
} ;
2220
2218
if is_file {
2221
2219
let mut file = open_file ( & path, false ) ?;
2222
2220
let format = detect ( file. as_mut ( ) )
2223
- . with_context ( || format ! ( "Detecting file type for {}" , path ) ) ?;
2221
+ . with_context ( || format ! ( "Detecting file type for {path}" ) ) ?;
2224
2222
match format {
2225
2223
FileFormat :: Archive ( ArchiveKind :: Disc ( format) ) => {
2226
2224
let fs = open_fs ( file, ArchiveKind :: Disc ( format) ) ?;
@@ -2249,23 +2247,23 @@ fn extract_objects(config: &ProjectConfig, object_base: &ObjectBase) -> Result<U
2249
2247
{
2250
2248
let target_path = extracted_path ( & target_dir, & config. base . object ) ;
2251
2249
if !fs:: exists ( & target_path)
2252
- . with_context ( || format ! ( "Failed to check path '{}'" , target_path ) ) ?
2250
+ . with_context ( || format ! ( "Failed to check path '{target_path }'" ) ) ?
2253
2251
{
2254
2252
object_paths. push ( ( & config. base . object , config. base . hash . as_deref ( ) , target_path) ) ;
2255
2253
}
2256
2254
}
2257
2255
if let Some ( selfile) = & config. selfile {
2258
2256
let target_path = extracted_path ( & target_dir, selfile) ;
2259
2257
if !fs:: exists ( & target_path)
2260
- . with_context ( || format ! ( "Failed to check path '{}'" , target_path ) ) ?
2258
+ . with_context ( || format ! ( "Failed to check path '{target_path }'" ) ) ?
2261
2259
{
2262
2260
object_paths. push ( ( selfile, config. selfile_hash . as_deref ( ) , target_path) ) ;
2263
2261
}
2264
2262
}
2265
2263
for module_config in & config. modules {
2266
2264
let target_path = extracted_path ( & target_dir, & module_config. object ) ;
2267
2265
if !fs:: exists ( & target_path)
2268
- . with_context ( || format ! ( "Failed to check path '{}'" , target_path ) ) ?
2266
+ . with_context ( || format ! ( "Failed to check path '{target_path }'" ) ) ?
2269
2267
{
2270
2268
object_paths. push ( ( & module_config. object , module_config. hash . as_deref ( ) , target_path) ) ;
2271
2269
}
@@ -2284,12 +2282,12 @@ fn extract_objects(config: &ProjectConfig, object_base: &ObjectBase) -> Result<U
2284
2282
let mut file = object_base. open ( source_path) ?;
2285
2283
if let Some ( parent) = target_path. parent ( ) {
2286
2284
fs:: create_dir_all ( parent)
2287
- . with_context ( || format ! ( "Failed to create directory '{}'" , parent ) ) ?;
2285
+ . with_context ( || format ! ( "Failed to create directory '{parent }'" ) ) ?;
2288
2286
}
2289
2287
let mut out = fs:: File :: create ( & target_path)
2290
- . with_context ( || format ! ( "Failed to create file '{}'" , target_path ) ) ?;
2288
+ . with_context ( || format ! ( "Failed to create file '{target_path }'" ) ) ?;
2291
2289
let hash_bytes = buf_copy_with_hash ( & mut file, & mut out)
2292
- . with_context ( || format ! ( "Failed to extract file '{}'" , target_path ) ) ?;
2290
+ . with_context ( || format ! ( "Failed to extract file '{target_path }'" ) ) ?;
2293
2291
if let Some ( hash) = hash {
2294
2292
check_hash_str ( hash_bytes, hash) . with_context ( || {
2295
2293
format ! ( "Source file failed verification: '{}'" , object_base. join( source_path) )
0 commit comments