@@ -27,7 +27,7 @@ pub mod target {
2727 /// Ensures that the `TARGET` is valid for cross compilation.
2828 pub fn ensure_supported ( ) {
2929 let target = Triple :: from_str ( & std:: env:: var ( TARGET_ENV_VAR_NAME ) . unwrap_or_else ( |_| {
30- panic ! ( "Missing environment variable `{}`." , TARGET_ENV_VAR_NAME ) ;
30+ panic ! ( "Missing environment variable `{TARGET_ENV_VAR_NAME }`." ) ;
3131 } ) )
3232 . expect ( "Failed to parse target triple." ) ;
3333 match ( target. architecture , target. operating_system ) {
@@ -37,10 +37,9 @@ pub mod target {
3737 | ( Architecture :: X86_64 , OperatingSystem :: Linux ) => { }
3838 ( arch, os) => {
3939 panic ! (
40- "Compilation target (architecture, OS) tuple ({}, {}) is not part of the \
40+ "Compilation target (architecture, OS) tuple ({arch }, {os }) is not part of the \
4141 supported tuples. Please compile with the \" generate-bindings\" feature or \
42- add support for your platform.",
43- arch, os
42+ add support for your platform."
4443 ) ;
4544 }
4645 }
@@ -163,10 +162,7 @@ pub mod tpm2_tss {
163162 std:: env:: var ( PATH_ENV_VAR_NAME ) . map_or_else (
164163 |e| match e {
165164 std:: env:: VarError :: NotUnicode ( invalid_value) => {
166- panic ! (
167- "Invalid `{}` env var: `{:?}`." ,
168- PATH_ENV_VAR_NAME , invalid_value
169- ) ;
165+ panic ! ( "Invalid `{PATH_ENV_VAR_NAME}` env var: `{invalid_value:?}`." ) ;
170166 }
171167 std:: env:: VarError :: NotPresent => None ,
172168 } ,
@@ -196,64 +192,53 @@ pub mod tpm2_tss {
196192 let install_path = PathBuf :: from ( env_var) ;
197193 if !install_path. is_dir ( ) {
198194 panic ! (
199- "The tpm2-tss installation path `{}` specifies an existing directory (`{}`)." ,
200- PATH_ENV_VAR_NAME ,
201- install_path. to_string_lossy( ) ,
195+ "The tpm2-tss installation path `{PATH_ENV_VAR_NAME}` specifies an existing directory (`{}`)." ,
196+ install_path. to_string_lossy( )
202197 ) ;
203198 }
204199 if !install_path. join ( "include" ) . is_dir ( ) {
205200 panic ! (
206- "The tpm2-tss installation path `{}` specifies a path `{}`, that does not \
201+ "The tpm2-tss installation path `{PATH_ENV_VAR_NAME }` specifies a path `{}`, that does not \
207202 contain an `include` directory",
208- PATH_ENV_VAR_NAME ,
209- install_path. to_string_lossy( ) ,
203+ install_path. to_string_lossy( )
210204 ) ;
211205 }
212206 if !install_path. join ( "lib" ) . is_dir ( ) {
213207 panic ! (
214- "The tpm2-tss installation path `{}` specifies a path `{}`, that does not \
208+ "The tpm2-tss installation path `{PATH_ENV_VAR_NAME }` specifies a path `{}`, that does not \
215209 contain an `lib` directory",
216- PATH_ENV_VAR_NAME ,
217- install_path. to_string_lossy( ) ,
210+ install_path. to_string_lossy( )
218211 ) ;
219212 }
220213 let version_str =
221214 std:: fs:: read_to_string ( install_path. join ( "VERSION" ) ) . unwrap_or_else ( |e| {
222215 panic ! (
223- "The tpm2-tss installation path `{}` specifies a path `{}`, that does not \
224- contain a readable VERSION file: {}.",
225- PATH_ENV_VAR_NAME ,
226- install_path. to_string_lossy( ) ,
227- e,
216+ "The tpm2-tss installation path `{PATH_ENV_VAR_NAME}` specifies a path `{}`, that does not \
217+ contain a readable VERSION file: {e}.",
218+ install_path. to_string_lossy( )
228219 ) ;
229220 } ) ;
230221 let version = Version :: parse ( version_str. trim ( ) ) . unwrap_or_else ( |e| {
231222 panic ! (
232- "The tpm2-tss installation path `{}` specifies a path `{}`, contains a \
233- VERSION file that cannot be parsed: {}.",
234- PATH_ENV_VAR_NAME ,
235- install_path. to_string_lossy( ) ,
236- e
223+ "The tpm2-tss installation path `{PATH_ENV_VAR_NAME}` specifies a path `{}`, contains a \
224+ VERSION file that cannot be parsed: {e}.",
225+ install_path. to_string_lossy( )
237226 ) ;
238227 } ) ;
239228
240- let min_version_req_str = format ! ( ">={}" , MINIMUM_VERSION ) ;
229+ let min_version_req_str = format ! ( ">={MINIMUM_VERSION}" ) ;
241230 let min_version_req = VersionReq :: parse ( & min_version_req_str) . unwrap_or_else ( |e| {
242231 panic ! (
243232 "[Internal Error]: Failed to parse minimum tpm2-tss library version \
244- requirement. Error: `{}`. Please report this.",
245- e
233+ requirement. Error: `{e}`. Please report this."
246234 ) ;
247235 } ) ;
248236 if !min_version_req. matches ( & version) {
249237 panic ! (
250- "The tpm2-tss installation path `{}` specifies a path `{}`, contains a \
251- VERSION file that specifies a version `{}` that does not meet the minimum \
252- version requirement `{}`.",
253- PATH_ENV_VAR_NAME ,
254- install_path. to_string_lossy( ) ,
255- version_str,
256- MINIMUM_VERSION ,
238+ "The tpm2-tss installation path `{PATH_ENV_VAR_NAME}` specifies a path `{}`, contains a \
239+ VERSION file that specifies a version `{version_str}` that does not meet the minimum \
240+ version requirement `{MINIMUM_VERSION}`.",
241+ install_path. to_string_lossy( )
257242 ) ;
258243 }
259244 println ! (
@@ -296,8 +281,7 @@ pub mod tpm2_tss {
296281 Self :: probe_optional ( lib_name, install_path, with_header_files) . map_or_else (
297282 || {
298283 panic ! (
299- "Failed to find {} library of version {MINIMUM_VERSION} or greater." ,
300- lib_name
284+ "Failed to find {lib_name} library of version {MINIMUM_VERSION} or greater."
301285 )
302286 } ,
303287 |lib| {
@@ -356,7 +340,7 @@ pub mod tpm2_tss {
356340 self . name
357341 ) ;
358342 } ,
359- |v| format ! ( "-I{}" , v ) ,
343+ |v| format ! ( "-I{v}" ) ,
360344 )
361345 }
362346
@@ -436,7 +420,7 @@ pub mod tpm2_tss {
436420 let lib_path = path. join ( "lib" ) ;
437421 Self :: lib_file ( lib_name, & lib_path) ?;
438422 // If the lib file was found then the name is reported to Cargo.
439- println ! ( "cargo:rustc-link-lib={}" , lib_name ) ;
423+ println ! ( "cargo:rustc-link-lib={lib_name}" ) ;
440424
441425 let include_path = path. join ( "include/tss2" ) ;
442426 Some ( Self {
@@ -481,8 +465,7 @@ pub mod tpm2_tss {
481465 let mut associated_files = hit_iter. collect :: < Vec < PathBuf > > ( ) ;
482466 associated_files. push ( hit. clone ( ) ) ;
483467 panic ! (
484- "More then one match found for library `{}`: {:?}" ,
485- lib_name, associated_files
468+ "More then one match found for library `{lib_name}`: {associated_files:?}" ,
486469 ) ;
487470 }
488471 }
0 commit comments