@@ -66,7 +66,7 @@ impl DeviceExt for Device {
6666 // Handle any deletions
6767 for pspec in device. str_vec_iter ( "_delete" ) {
6868 self . delete_peripheral ( pspec)
69- . with_context ( || format ! ( "Deleting peripheral matched to `{}`" , pspec ) ) ?;
69+ . with_context ( || format ! ( "Deleting peripheral matched to `{pspec }`" ) ) ?;
7070 }
7171
7272 // Handle any copied peripherals
@@ -77,7 +77,7 @@ impl DeviceExt for Device {
7777 val. hash ( ) ?,
7878 Path :: new ( device. get_str ( "_path" ) ?. unwrap_or ( "." ) ) ,
7979 )
80- . with_context ( || format ! ( "Copying peripheral `{}`" , pname ) ) ?;
80+ . with_context ( || format ! ( "Copying peripheral `{pname }`" ) ) ?;
8181 }
8282
8383 // Handle any modifications
@@ -92,7 +92,7 @@ impl DeviceExt for Device {
9292 let pspec = pspec. str ( ) ?;
9393 self . modify_peripheral ( pspec, pmod. hash ( ) ?)
9494 . with_context ( || {
95- format ! ( "Modifying peripherals matched to `{}`" , pspec )
95+ format ! ( "Modifying peripherals matched to `{pspec }`" )
9696 } ) ?;
9797 }
9898 }
@@ -115,40 +115,37 @@ impl DeviceExt for Device {
115115
116116 _ => self
117117 . modify_peripheral ( key, val. hash ( ) ?)
118- . with_context ( || format ! ( "Modifying peripherals matched to `{}`" , key ) ) ?,
118+ . with_context ( || format ! ( "Modifying peripherals matched to `{key }`" ) ) ?,
119119 }
120120 }
121121
122122 // Handle field clearing
123123 for pspec in device. str_vec_iter ( "_clear_fields" ) {
124124 self . clear_fields ( pspec) . with_context ( || {
125- format ! (
126- "Clearing contents of fields in peripherals matched to `{}` " ,
127- pspec
128- )
125+ format ! ( "Clearing contents of fields in peripherals matched to `{pspec}` " )
129126 } ) ?;
130127 }
131128
132129 // Handle any new peripherals (!)
133130 for ( pname, padd) in device. hash_iter ( "_add" ) {
134131 let pname = pname. str ( ) ?;
135132 self . add_peripheral ( pname, padd. hash ( ) ?)
136- . with_context ( || format ! ( "Adding peripheral `{}`" , pname ) ) ?;
133+ . with_context ( || format ! ( "Adding peripheral `{pname }`" ) ) ?;
137134 }
138135
139136 // Handle any derived peripherals
140137 for ( pname, pderive) in device. hash_iter ( "_derive" ) {
141138 let pname = pname. str ( ) ?;
142139 self . derive_peripheral ( pname, pderive)
143- . with_context ( || format ! ( "Deriving peripheral `{}` from `{:?}`" , pname , pderive ) ) ?;
140+ . with_context ( || format ! ( "Deriving peripheral `{pname }` from `{pderive :?}`" ) ) ?;
144141 }
145142
146143 // Handle any rebased peripherals
147144 for ( pname, pold) in device. hash_iter ( "_rebase" ) {
148145 let pname = pname. str ( ) ?;
149146 let pold = pold. str ( ) ?;
150147 self . rebase_peripheral ( pname, pold)
151- . with_context ( || format ! ( "Rebasing peripheral from `{}` to `{}`" , pold , pname ) ) ?;
148+ . with_context ( || format ! ( "Rebasing peripheral from `{pold }` to `{pname }`" ) ) ?;
152149 }
153150
154151 // Now process all peripherals
@@ -157,7 +154,7 @@ impl DeviceExt for Device {
157154 if !periphspec. starts_with ( '_' ) {
158155 //val["_path"] = device["_path"]; // TODO: check
159156 self . process_peripheral ( periphspec, val. hash ( ) ?, update_fields)
160- . with_context ( || format ! ( "According to `{}`" , periphspec ) ) ?;
157+ . with_context ( || format ! ( "According to `{periphspec }`" ) ) ?;
161158 }
162159 }
163160
@@ -181,16 +178,16 @@ impl DeviceExt for Device {
181178 let mut contents = String :: new ( ) ;
182179 ( & f) . read_to_string ( & mut contents) . unwrap ( ) ;
183180 let filedev = svd_parser:: parse ( & contents)
184- . with_context ( || format ! ( "Parsing file {}" , contents ) ) ?;
181+ . with_context ( || format ! ( "Parsing file {contents}" ) ) ?;
185182 filedev
186183 . get_peripheral ( pcopyname)
187- . ok_or_else ( || anyhow ! ( "peripheral {} not found" , pcopyname ) ) ?
184+ . ok_or_else ( || anyhow ! ( "peripheral {pcopyname } not found" ) ) ?
188185 . clone ( )
189186 }
190187 [ pcopyname] => {
191188 let mut new = self
192189 . get_peripheral ( pcopyname)
193- . ok_or_else ( || anyhow ! ( "peripheral {} not found" , pcopyname ) ) ?
190+ . ok_or_else ( || anyhow ! ( "peripheral {pcopyname } not found" ) ) ?
194191 . clone ( ) ;
195192 // When copying from a peripheral in the same file, remove any interrupts.
196193 new. interrupt = Vec :: new ( ) ;
@@ -265,7 +262,7 @@ impl DeviceExt for Device {
265262
266263 fn add_peripheral ( & mut self , pname : & str , padd : & Hash ) -> PatchResult {
267264 if self . get_peripheral ( pname) . is_some ( ) {
268- return Err ( anyhow ! ( "device already has a peripheral {}" , pname ) ) ;
265+ return Err ( anyhow ! ( "device already has a peripheral {pname}" ) ) ;
269266 }
270267
271268 self . peripherals . push (
@@ -300,7 +297,7 @@ impl DeviceExt for Device {
300297
301298 if !pderive. contains ( '.' ) {
302299 self . get_peripheral ( pderive)
303- . ok_or_else ( || anyhow ! ( "peripheral {} not found" , pderive ) ) ?;
300+ . ok_or_else ( || anyhow ! ( "peripheral {pderive } not found" ) ) ?;
304301 }
305302
306303 match self . get_mut_peripheral ( pname) {
@@ -324,7 +321,7 @@ impl DeviceExt for Device {
324321 fn rebase_peripheral ( & mut self , pnew : & str , pold : & str ) -> PatchResult {
325322 let old = self
326323 . get_mut_peripheral ( pold)
327- . ok_or_else ( || anyhow ! ( "peripheral {} not found" , pold ) ) ?;
324+ . ok_or_else ( || anyhow ! ( "peripheral {pold } not found" ) ) ?;
328325 let mut d = std:: mem:: replace (
329326 old,
330327 PeripheralInfo :: builder ( )
@@ -341,7 +338,7 @@ impl DeviceExt for Device {
341338 ) ;
342339 let new = self
343340 . get_mut_peripheral ( pnew)
344- . ok_or_else ( || anyhow ! ( "peripheral {} not found" , pnew ) ) ?;
341+ . ok_or_else ( || anyhow ! ( "peripheral {pnew } not found" ) ) ?;
345342 d. name = new. name . clone ( ) ;
346343 d. base_address = new. base_address ;
347344 d. interrupt = new. interrupt . clone ( ) ;
@@ -380,7 +377,7 @@ impl DeviceExt for Device {
380377 . with_context ( || format ! ( "Processing peripheral `{}`" , ptag. name) ) ?;
381378 }
382379 if pcount == 0 {
383- Err ( anyhow ! ( "Could not find `{}`" , pspec ) )
380+ Err ( anyhow ! ( "Could not find `{pspec }`" ) )
384381 } else {
385382 Ok ( ( ) )
386383 }
0 commit comments